CodecademyCommunity / codecademy-discord-bot

Custom moderation bot for the official Codecademy Community Discord server.
https://codecademycommunity.github.io/
MIT License
11 stars 1 forks source link

Add ban and unban slash commands #320

Closed mikejoh12 closed 2 years ago

mikejoh12 commented 2 years ago

What issue is this solving?

Closes #296

Description

Adds ban and unban slash commands. Ban now works for a user that has DMs disabled or is not part of the guild as long as the user-id is entered. The ban command also includes an option for 0 to 7 days of messages to delete when banning a user. This range was chosen because it's what the discord.js API supports.

I added the command permissions to the commandRoles permission handler for consistency even though now with Discord permissions v2 that functionality of setting command permissions does not work.

Any helpful knowledge/context for the reviewer?

Since our programmatic permission setting is currently not working you may need to go to Server Settings -> Interactions -> Your Dev Bot and enable the command manually for the Moderator role and above.

Please make sure you've attempted to meet the following coding standards