Don't attempt to send log messages if the bot doesn't have permissions
This commit is contained in:
@@ -33,9 +33,14 @@ namespace PluralKit.Bot {
|
||||
// Bail if we can't find the channel
|
||||
if (!(await _client.GetChannelAsync(guildCfg.Value.LogChannel.Value) is ITextChannel logChannel)) return;
|
||||
|
||||
// Bail if we don't have permission to send stuff here
|
||||
if (!logChannel.HasPermission(ChannelPermission.SendMessages) || !logChannel.HasPermission(ChannelPermission.EmbedLinks))
|
||||
return;
|
||||
|
||||
var embed = _embed.CreateLoggedMessageEmbed(system, member, messageId, originalMsgId, sender, content, originalChannel);
|
||||
|
||||
var url = $"https://discordapp.com/channels/{originalChannel.GuildId}/{originalChannel.Id}/{messageId}";
|
||||
|
||||
await logChannel.SendMessageAsync(text: url, embed: embed);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user