discord-modmail / modmail

A Modmail bot for Discord. Allowing safe moderator conversations with server members one server at a time.
https://discord-modmail.readthedocs.io/
MIT License
15 stars 8 forks source link

feat/error handler #77

Closed onerandomusername closed 2 years ago

onerandomusername commented 2 years ago
codecov[bot] commented 2 years ago

Codecov Report

Merging #77 (144b008) into main (b5ab21f) will decrease coverage by 5.32%. The diff coverage is 0.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main      #77      +/-   ##
==========================================
- Coverage   38.62%   33.29%   -5.33%     
==========================================
  Files          16       17       +1     
  Lines         769      892     +123     
  Branches      105      132      +27     
==========================================
  Hits          297      297              
- Misses        459      582     +123     
  Partials       13       13              
Impacted Files Coverage Δ
modmail/extensions/utils/error_handler.py 0.00% <0.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update b5ab21f...144b008. Read the comment docs.

onerandomusername commented 2 years ago

There is a fundamental issue with the botmissingpermissions error handling. In almost all send message cases, the bot will make a second case which will 100% fail.

The bot should check its cache or request the channel perms to see if it has send message perms. If it does, should also check for embed image permissions, and send a standard message of content if that fails.

if that is not a valid permission, the bot should see if it has add_reaction permissions and maybe add a :x: if it can.

onerandomusername commented 2 years ago

There is a fundamental issue with the botmissingpermissions error handling. In almost all send message cases, the bot will make a second case which will 100% fail.

The bot should check its cache or request the channel perms to see if it has send message perms. If it does, should also check for embed image permissions, and send a standard message of content if that fails.

if that is not a valid permission, the bot should see if it has add_reaction permissions and maybe add a :x: if it can.

This is implemented in 7f19996