Rename BotHasPermission to a more descriptive name
This commit is contained in:
@@ -47,8 +47,7 @@ namespace PluralKit.Bot {
|
||||
if (channel.Type != ChannelType.Text) return;
|
||||
|
||||
// Bail if we don't have permission to send stuff here
|
||||
var neededPermissions = Permissions.SendMessages | Permissions.EmbedLinks;
|
||||
if ((channel.BotPermissions() & neededPermissions) != neededPermissions)
|
||||
if (!channel.BotHasAllPermissions(Permissions.SendMessages | Permissions.EmbedLinks))
|
||||
return;
|
||||
|
||||
var embed = _embed.CreateLoggedMessageEmbed(system, member, messageId, originalMsgId, sender, content, originalChannel);
|
||||
|
@@ -67,7 +67,7 @@ namespace PluralKit.Bot
|
||||
// Bail if not enabled, or if we don't have permission here
|
||||
if (!cachedGuild.LogCleanupEnabled) return;
|
||||
if (msg.Channel.Type != ChannelType.Text) return;
|
||||
if (!msg.Channel.BotHasPermission(Permissions.ManageMessages)) return;
|
||||
if (!msg.Channel.BotHasAllPermissions(Permissions.ManageMessages)) return;
|
||||
|
||||
// If this message is from a *webhook*, check if the name matches one of the bots we know
|
||||
// TODO: do we need to do a deeper webhook origin check, or would that be too hard on the rate limit?
|
||||
|
@@ -287,7 +287,7 @@ namespace PluralKit.Bot
|
||||
await args.Channel.SendMessageAsync($"Psst, **{msg.Member.DisplayName ?? msg.Member.Name}** (<@{msg.Message.Sender}>), you have been pinged by <@{args.User.Id}>.", embed: embed.Build());
|
||||
|
||||
// Finally remove the original reaction (if we can)
|
||||
if (args.Channel.BotHasPermission(Permissions.ManageMessages))
|
||||
if (args.Channel.BotHasAllPermissions(Permissions.ManageMessages))
|
||||
await args.Message.DeleteReactionAsync(args.Emoji, args.User);
|
||||
}
|
||||
|
||||
@@ -323,7 +323,7 @@ namespace PluralKit.Bot
|
||||
public async Task HandleMessageDeletionByReaction(MessageReactionAddEventArgs args)
|
||||
{
|
||||
// Bail if we don't have permission to delete
|
||||
if (!args.Channel.BotHasPermission(Permissions.ManageMessages)) return;
|
||||
if (!args.Channel.BotHasAllPermissions(Permissions.ManageMessages)) return;
|
||||
|
||||
// Find the message in the database
|
||||
var storedMessage = await _data.GetMessage(args.Message.Id);
|
||||
|
Reference in New Issue
Block a user