The title speaks for itself, please help, pretty please.
Asked
Active
Viewed 361 times
0
-
Do you want to use any discord library? Or do you just want to know how to do it via raw Discord API? – mozkomor05 Jul 05 '20 at 17:16
-
@DavidMoškoř oh im sorry, i want to use discordia – exdii Jul 05 '20 at 17:18
-
`message` has `member` property. See here: https://github.com/SinisterRectus/Discordia/wiki/Message – mozkomor05 Jul 05 '20 at 17:21
-
@DavidMoškoř yes i know that, i am using it to allow commands in dms. now that you edited it i can say that i definitely know it – exdii Jul 05 '20 at 17:22
-
Ok. If you read the documentation you can see, that the `member` class has an `hasPermission` function. https://github.com/SinisterRectus/Discordia/wiki/Member – mozkomor05 Jul 05 '20 at 17:24
-
@DavidMoškoř thanks! although, how does it work? like this maybe member:hasPermission(BAN_USERS) ? – exdii Jul 05 '20 at 17:27
-
I'll post an answer. – mozkomor05 Jul 05 '20 at 17:34
-
@DavidMoškoř ok – exdii Jul 05 '20 at 17:47
1 Answers
0
The member
class contains hasPermission
function. So the code to check if message author has permission would look like this:
if message.member:hasPermission(banMembers) then
-- do action
end
Useful links:
- Lua documentation: https://github.com/SinisterRectus/Discordia/wiki/
- All permision's enums: https://github.com/SinisterRectus/Discordia/wiki/Enumerations#permission

mozkomor05
- 1,367
- 11
- 21
-
it gives off an error `Uncaught Error: D:/Bot/deps/coro-channel.lua:62: D:/Bot/deps/discordia/libs/utils/Emitter.lua:105: Invalid permission: nil` – exdii Jul 05 '20 at 18:00
-
I see. The documentation say that the first parameter is optional so i passed `nil`. But it seems like documentation is outdated. Simply remove the first parameter. I'll update my answer. – mozkomor05 Jul 05 '20 at 18:01