Split if statement for more clarity
This commit is contained in:
parent
3a94de9f23
commit
c34a396c78
1 changed files with 24 additions and 18 deletions
|
@ -76,9 +76,15 @@ internal static class EventHandler
|
|||
return;
|
||||
}
|
||||
|
||||
// Sends a DM to the assigned staff member if at least a day has gone by since the last message and the user sending the message isn't staff
|
||||
// Ignore staff messages
|
||||
if (Database.IsStaff(e.Author.Id))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Sends a DM to the assigned staff member if at least a day has gone by since the last message
|
||||
IReadOnlyList<DiscordMessage> messages = await e.Channel.GetMessagesAsync(2);
|
||||
if (messages.Count > 1 && messages[1].Timestamp < DateTimeOffset.UtcNow.AddDays(Config.ticketUpdatedNotificationDelay * -1) && !Database.IsStaff(e.Author.Id))
|
||||
if (messages.Count > 1 && messages[1].Timestamp < DateTimeOffset.UtcNow.AddDays(Config.ticketUpdatedNotificationDelay * -1))
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -99,17 +105,17 @@ internal static class EventHandler
|
|||
switch (e.Exception)
|
||||
{
|
||||
case SlashExecutionChecksFailedException checksFailedException:
|
||||
{
|
||||
foreach (SlashCheckBaseAttribute attr in checksFailedException.FailedChecks)
|
||||
{
|
||||
await e.Context.Channel.SendMessageAsync(new DiscordEmbedBuilder
|
||||
foreach (SlashCheckBaseAttribute attr in checksFailedException.FailedChecks)
|
||||
{
|
||||
Color = DiscordColor.Red,
|
||||
Description = ParseFailedCheck(attr)
|
||||
});
|
||||
await e.Context.Channel.SendMessageAsync(new DiscordEmbedBuilder
|
||||
{
|
||||
Color = DiscordColor.Red,
|
||||
Description = ParseFailedCheck(attr)
|
||||
});
|
||||
}
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
case BadRequestException ex:
|
||||
Logger.Error("Command exception occured:\n" + e.Exception);
|
||||
|
@ -117,15 +123,15 @@ internal static class EventHandler
|
|||
return;
|
||||
|
||||
default:
|
||||
{
|
||||
Logger.Error("Exception occured: " + e.Exception.GetType() + ": " + e.Exception);
|
||||
await e.Context.Channel.SendMessageAsync(new DiscordEmbedBuilder
|
||||
{
|
||||
Color = DiscordColor.Red,
|
||||
Description = "Internal error occured, please report this to the developer."
|
||||
});
|
||||
return;
|
||||
}
|
||||
Logger.Error("Exception occured: " + e.Exception.GetType() + ": " + e.Exception);
|
||||
await e.Context.Channel.SendMessageAsync(new DiscordEmbedBuilder
|
||||
{
|
||||
Color = DiscordColor.Red,
|
||||
Description = "Internal error occured, please report this to the developer."
|
||||
});
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue