aniket091 / Gamecord

Discord Gamecord is a powerful npm package with a collection of minigames for your discord bot :)
https://discord-gamecord.js.org/
MIT License
103 stars 37 forks source link

[BUG] Bot crashes when missing permissions to channel #12

Open liamyxm opened 1 year ago

liamyxm commented 1 year ago

Describe the bug If you use any gamecord game, remove the bot's perms, then once the bot tries to edit the message, the bot crashes due to Missing Access.

To Reproduce

  1. Use any gamecord game
  2. Remove its permissions
  3. The bot tries to edit the message (because thats how it works)
  4. The bot can't edit it and crashes

Expected behavior I expected the bot to simply cancel the game, but it crashes.

Screenshots image

Please complete the following information:

Additional context This may cause issues once the bot joins more servers and one of the servers' admins tries to crash the bot with malicious intent. I believe a simple way to fix this would be: if (!message.channel.permissionsFor(client.user).toArray().includes('SendMessages')) return;

GhostWasFound13 commented 1 year ago

Its this going to fix the issues?