ZeNyfh / gigavibe-java-edition

Music + Media bot made in java using JDA and Lavaplayer.
GNU General Public License v3.0
8 stars 3 forks source link

add permissions check #126

Closed ZeNyfh closed 5 months ago

ZeNyfh commented 10 months ago

add a check to see if the bot has permissions, if not, error

for example:

etc

9382 commented 8 months ago

check if bot has message perms (unsure how to error this)

Normally message replies come at the very end of a logic chain, so a reply failing isnt the end of the world, though it might help to just avoid sending the message entirely for cases like play which send a starting message. Plus, it's a very rare situation for someone to be able to see but not read messages in a channel where bot commands would also be used

9382 commented 5 months ago

I decided to do some experimentation - slash commands negates any message channel related permissions no problem - even channels the bot isn't allowed to see nor message in can be replied to if using slash commands and the current system handles it fine. Also, no such thing as "embed perms", so that point is invalid VC permissions is a real and relevant matter and this should be checked for. I've added some basic code to show what this looks like at a simple level, though it could be nicer to centralise this behaviour if spreading stuff out like this is a concern (though its not a huge issue right now, or maybe ever)