Question about getting a user from his ID

In short I get the userid from the database with mutes and pass it to const member = guild.members.cache.get(row.id); but when the bot needs to remove the role, it logs me an error: 02/27 11:14:01 [Bot] member.roles.remove(mutedRoleId); 27.02 11:14:01 [Bot] ^ 02/27 11:14:01 [Bot] TypeError: Cannot read properties of undefined (reading 'roles')
14 Replies
d.js toolkit
d.js toolkit9mo ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button! - Marked as resolved by OP
/|ĶÎŦÃŖŮ|\
/|ĶÎŦÃŖŮ|\OP9mo ago
No description
d.js docs
d.js docs9mo ago
Documentation suggestion for @/|ĶÎŦÃŖŮ|: :method: GuildMemberManager#fetch() Fetches member(s) from a guild.
/|ĶÎŦÃŖŮ|\
/|ĶÎŦÃŖŮ|\OP9mo ago
27.02 11:51:31 [Bot] member.roles.remove(mutedRoleId); 27.02 11:51:31 [Bot] ^ 27.02 11:51:31 [Bot] TypeError: Cannot read properties of undefined (reading 'remove')
Unknown User
Unknown User9mo ago
Message Not Public
Sign In & Join Server To View
/|ĶÎŦÃŖŮ|\
/|ĶÎŦÃŖŮ|\OP9mo ago
No description
Unknown User
Unknown User9mo ago
Message Not Public
Sign In & Join Server To View
/|ĶÎŦÃŖŮ|\
/|ĶÎŦÃŖŮ|\OP9mo ago
i reading that and trying
Unknown User
Unknown User9mo ago
Message Not Public
Sign In & Join Server To View
/|ĶÎŦÃŖŮ|\
/|ĶÎŦÃŖŮ|\OP9mo ago
guild.removeRole(row.id, mutedRoleId) Something like this?
Unknown User
Unknown User9mo ago
Message Not Public
Sign In & Join Server To View
/|ĶÎŦÃŖŮ|\
/|ĶÎŦÃŖŮ|\OP9mo ago
oh guild.removeRole({ user: member, role: mutedRole }); 27.02 12:06:46 [Bot] ^ 27.02 12:06:46 [Bot] TypeError: guild.removeRole is not a function
/|ĶÎŦÃŖŮ|\
/|ĶÎŦÃŖŮ|\OP9mo ago
No description
/|ĶÎŦÃŖŮ|\
/|ĶÎŦÃŖŮ|\OP9mo ago
I think Fetch is a async func I add await and it work now
Want results from more Discord servers?
Add your server