How the heck do i test if the bot has a certain permission in message event #2497
Answered
by
arqunis
MCorange99
asked this question in
Q&A
-
How the heck do i test if the bot has a certain permission in message event. msg.member.clone().unwrap().permissions.unwrap(); // panics cause permissions is none |
Beta Was this translation helpful? Give feedback.
Answered by
arqunis
Jul 22, 2023
Replies: 1 comment
-
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
MCorange99
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The
Member::permissions
field is onlySome
when theMember
instance is from an interaction, like a slash command or message component. In regular situations, you have to calculate the permissions the member has.There are plenty of methods for doing that, so I recommend using the one that's most relevant to you: