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

Update mute handling for v13 #274

Closed Victoria-DR closed 2 years ago

Victoria-DR commented 2 years ago

What issue is this solving?

Closes #273 Closes #218

Description

I've refactored how the handling works. The role creation remains the same, and the same process still runs when a new channel is created. However, instead of updated channel overwrites every time the guildMemberUpdate event runs (which is every nickname change, role change of a user, etc.), it now runs just once when the role is created and creates permanent permission overrides for the On Mute role in all channels.

With the new update to threads, I've denied permissions for muted users to create or send messages in threads as well. They also cannot upload files or use slash commands.

When we upgrade the actual bot on the community server, this will necessitate completely removing the bot from the server, then re-adding it.

Any helpful knowledge/context for the reviewer?

Steps to Test

  1. Remove your bot from the server.
  2. Add your bot to the server with Administrator permissions.
  3. Ensure that an On Mute role is created by the bot upon joining the server (if such a role does not already exist in the server).
  4. Ensure that all channels have a permission override where the On Mute role cannot send text messages, send messages in threads, etc.
  5. When new channels are created, they should also have the override mentioned in step 5.
  6. Should not result in any other unexpected behaviour (muted users seeing private channels, etc.)

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