-
Hello Here is the code: app.get("/yonet", async(req, res) => {
if(!req.user) return res.redirect("/hata?type=giris")
let id = req.query.server
if(!id) return res.redirect("/hata?type=bulunamadı")
let p = new Promise(async (resolve, reject) => {
let sunucu = await client.guilds.cache.get(id)
let a = await sunucu.members.cache.get(req.user.id)
console.log(a)
if(a.permissions.has("MANAGE_GUILD")){
resolve()
}else {
reject()
}
p.then((pe) => {
console.log(pe)
})
})
renderTemplate(res, req, "yonet/server.ejs", {id})
})```
And the error:
```js
if(a.permissions.has("MANAGE_GUILD")){
^
TypeError: Cannot read property 'permissions' of undefined PLS help asap |
Beta Was this translation helpful? Give feedback.
Answered by
almeidx
Sep 6, 2021
Replies: 1 comment
-
That error suggests the user was not found in the cache. So, instead of relying solely on it (the cache), fetch the member using |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
kyranet
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
That error suggests the user was not found in the cache.
So, instead of relying solely on it (the cache), fetch the member using
await sunucu.members.fetch(req.user.id)