-
Please describe the problem you are having in as much detail as possible: 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}) The errorr if(a.permissions.has("MANAGE_GUILD")){
^
TypeError: Cannot read property 'permissions' of undefined Further details:
Relevant client options:
|
Beta Was this translation helpful? Give feedback.
Replies: 5 comments
-
Btw i asked this error on discord and no one else found solution |
Beta Was this translation helpful? Give feedback.
-
This doesn't seem like a bug, but a lack of understanding. Feel free to make a new discussion about it, as this issue tracker is for bug reports and enhancement suggestions. |
Beta Was this translation helpful? Give feedback.
-
Should i close this issue? |
Beta Was this translation helpful? Give feedback.
-
Don't worry, I can just do this. |
Beta Was this translation helpful? Give feedback.
-
Okay, there are a lot of problems here.
let sunucu = await client.guilds.cache.get(id)
let a = await sunucu.members.cache.get(req.user.id) These methods don't return a
After all of this, I assume the problem is that your member is not cached. Code needs tidying! |
Beta Was this translation helpful? Give feedback.
Okay, there are a lot of problems here.
p
is defined as aPromise
, but the code in there doesn't need it to be. You also include a reference to itself in there.await
s here:These methods don't return a
Promise
(which adds to point 2).GUILD_MEMBERS
one. I feel like you should be includingGUILDS
too.After all of this, I a…