Don't send ping message if bot doesn't have permissions

This commit is contained in:
Ske 2020-05-09 15:51:26 +02:00
parent 65bac86ac1
commit 60018bf69d

View File

@ -268,8 +268,9 @@ namespace PluralKit.Bot
private async Task HandleMessagePingByReaction(MessageReactionAddEventArgs args) private async Task HandleMessagePingByReaction(MessageReactionAddEventArgs args)
{ {
// Bail in DMs // Bail in DMs or if we don't have send permission
if (args.Channel.Type != ChannelType.Text) return; if (args.Channel.Type != ChannelType.Text) return;
if (!args.Channel.BotHasAllPermissions(Permissions.SendMessages)) return;
// Find the message in the DB // Find the message in the DB
var msg = await _data.GetMessage(args.Message.Id); var msg = await _data.GetMessage(args.Message.Id);