Bail early if we don't have send message permission when proxying

This commit is contained in:
Ske 2020-01-08 12:16:27 +01:00
parent 66eb012e4a
commit cb1c44a27f

View File

@ -167,6 +167,10 @@ namespace PluralKit.Bot
var guildUser = await channel.Guild.GetCurrentUserAsync();
var permissions = guildUser.GetPermissions(channel);
// If we can't send messages at all, just bail immediately.
// TODO: can you have ManageMessages and *not* SendMessages? What happens then?
if (!permissions.SendMessages && !permissions.ManageMessages) return false;
if (!permissions.ManageWebhooks)
{
// todo: PKError-ify these