modmailbot icon indicating copy to clipboard operation
modmailbot copied to clipboard

Better error messages when permissions are missing

Open SuperSajuuk opened this issue 4 years ago • 3 comments

Hi there, first time for me posting in this github repo, but I found a bug with modmail threads specifically about denied permissions when the requisite function is invoked.

The below are steps to reproduce this with Manage Messages being denied, but could be applied to anything that would cause Error: Missing Permissions to be logged in your error logs.

The general premise of this ticket should be to show more verbose/clearer error messages when attempting to do an action that won't run.

Steps to Reproduce:

  1. Set up a selfhosted instance
  2. Invite the bot to your server but don't provide Manage Messages
  3. Invoke a command that would result in a call to delete the invokers message
  4. Observe

Expected Result: The bot stays up despite the missing permissions Actual Result: The bot crashes out because it doesn't have a catch for the missing perm.

Hope this can be resolved! Obviously the permissions should be there, but for those like me who completely miss that a perm is needed, it would be good to have more clear error logs. :D

SuperSajuuk avatar Jun 13 '20 19:06 SuperSajuuk

This is functioning as designed. It is not desirable to have the bot appear online but non-functional. If you were inattentive, the bot showing offline on the server would let you know to check the logs to correct the issue. v / r Robert Klebes Mobile: 571-492-8639 https://keybase.io/sporkwitch https://www.linkedin.com/in/klebes

On June 13, 2020 3:26:02 PM EDT, Sajuuk [email protected] wrote:

Hi there, first time for me posting in this github repo, but I found a bug with modmail threads specifically about denied permissions when the requisite function is invoked.

The below are steps to reproduce this with Manage Messages being denied, but could be applied to anything that would cause Error: Missing Permissions to be logged in your error logs.

The general premise of this ticket should be to show more verbose/clearer error messages when attempting to do an action that won't run.

Steps to Reproduce:

  1. Set up a selfhosted instance
  2. Invite the bot to your server but don't provide Manage Messages
  3. Invoke a command that would result in a call to delete the invokers message
  4. Observe

Expected Result: The bot stays up despite the missing permissions Actual Result: The bot crashes out because it doesn't have a catch for the missing perm.

Hope this can be resolved! Obviously the permissions should be there, but for those like me who completely miss that a perm is needed, it would be good to have more clear error logs. :D

-- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/Dragory/modmailbot/issues/400

sporkwitch avatar Jun 13 '20 20:06 sporkwitch

This could definitely use improvements. Either the error messages need to include a stack trace (there's a bug here that will be fixed soon) or otherwise be more descriptive, or the errors should be handled on the bot's side. But the current situation where the only error you get is "Missing Permissions" without a stack trace or other context is not ideal.

Dragory avatar Jun 13 '20 21:06 Dragory

I concur. Optimal would be reporting e. g. "Missing Manage Channels permission in category ". Is it possible for the bot to check its own permissions on startup for the server and categories in the configuration and bail with a failure report if anything's missing?

dopeghoti avatar Jun 13 '20 22:06 dopeghoti