mirror of
https://github.com/RPCS3/discord-bot.git
synced 2025-02-05 01:47:51 +00:00
more permission checks in backlog handler
This commit is contained in:
parent
7331e82a27
commit
877de86ff2
@ -45,12 +45,19 @@ namespace CompatBot.EventHandlers
|
||||
var after = DateTime.UtcNow - Config.ModerationTimeThreshold;
|
||||
foreach (var channel in guild.Channels.Values.Where(ch => !ch.IsCategory && ch.Type != ChannelType.Voice))
|
||||
{
|
||||
if (!channel.PermissionsFor(botMember).HasPermission(Permissions.ReadMessageHistory))
|
||||
var permissions = channel.PermissionsFor(botMember);
|
||||
if (!permissions.HasPermission(Permissions.ReadMessageHistory))
|
||||
{
|
||||
Config.Log.Warn($"No permissions to read message history in #{channel.Name}");
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!permissions.HasPermission(Permissions.AccessChannels))
|
||||
{
|
||||
Config.Log.Warn($"No permissions to access #{channel.Name}");
|
||||
continue;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
var messages = await channel.GetMessagesAsync(500).ConfigureAwait(false);
|
||||
|
Loading…
x
Reference in New Issue
Block a user