Catch not found exceptions
This commit is contained in:
parent
d70c2ae0d2
commit
03497a28f8
12 changed files with 100 additions and 63 deletions
|
@ -5,6 +5,7 @@ using DSharpPlus.Commands;
|
||||||
using DSharpPlus.Commands.ContextChecks;
|
using DSharpPlus.Commands.ContextChecks;
|
||||||
using DSharpPlus.Commands.Processors.SlashCommands;
|
using DSharpPlus.Commands.Processors.SlashCommands;
|
||||||
using DSharpPlus.Entities;
|
using DSharpPlus.Entities;
|
||||||
|
using DSharpPlus.Exceptions;
|
||||||
|
|
||||||
namespace SupportChild.Commands;
|
namespace SupportChild.Commands;
|
||||||
|
|
||||||
|
@ -30,7 +31,6 @@ public class AddCommand
|
||||||
DiscordMember member;
|
DiscordMember member;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// TODO: This throws an exception instead of returning null now
|
|
||||||
member = (user == null ? command.Member : await command.Guild.GetMemberAsync(user.Id));
|
member = (user == null ? command.Member : await command.Guild.GetMemberAsync(user.Id));
|
||||||
|
|
||||||
if (member == null)
|
if (member == null)
|
||||||
|
@ -62,12 +62,10 @@ public class AddCommand
|
||||||
Description = "Added " + member.Mention + " to ticket."
|
Description = "Added " + member.Mention + " to ticket."
|
||||||
});
|
});
|
||||||
|
|
||||||
// TODO: This throws an exception instead of returning null now
|
|
||||||
|
|
||||||
// Log it if the log channel exists
|
// Log it if the log channel exists
|
||||||
DiscordChannel logChannel = await command.Guild.GetChannelAsync(Config.logChannel);
|
try
|
||||||
if (logChannel != null)
|
|
||||||
{
|
{
|
||||||
|
DiscordChannel logChannel = await SupportChild.client.GetChannelAsync(Config.logChannel);
|
||||||
await logChannel.SendMessageAsync(new DiscordEmbedBuilder
|
await logChannel.SendMessageAsync(new DiscordEmbedBuilder
|
||||||
{
|
{
|
||||||
Color = DiscordColor.Green,
|
Color = DiscordColor.Green,
|
||||||
|
@ -75,6 +73,10 @@ public class AddCommand
|
||||||
" by " + command.Member?.Mention + "."
|
" by " + command.Member?.Mention + "."
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
catch (NotFoundException)
|
||||||
|
{
|
||||||
|
Logger.Error("Could not find the log channel.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (Exception)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
|
|
|
@ -5,6 +5,7 @@ using DSharpPlus.Commands;
|
||||||
using DSharpPlus.Commands.ContextChecks;
|
using DSharpPlus.Commands.ContextChecks;
|
||||||
using DSharpPlus.Commands.Processors.SlashCommands;
|
using DSharpPlus.Commands.Processors.SlashCommands;
|
||||||
using DSharpPlus.Entities;
|
using DSharpPlus.Entities;
|
||||||
|
using DSharpPlus.Exceptions;
|
||||||
using MySqlConnector;
|
using MySqlConnector;
|
||||||
|
|
||||||
namespace SupportChild.Commands;
|
namespace SupportChild.Commands;
|
||||||
|
@ -57,17 +58,19 @@ public class AddStaffCommand
|
||||||
Description = staffMember.Mention + " was added to staff."
|
Description = staffMember.Mention + " was added to staff."
|
||||||
});
|
});
|
||||||
|
|
||||||
// TODO: This throws an exception instead of returning null now
|
try
|
||||||
|
|
||||||
// Log it if the log channel exists
|
|
||||||
DiscordChannel logChannel = await command.Guild.GetChannelAsync(Config.logChannel);
|
|
||||||
if (logChannel != null)
|
|
||||||
{
|
{
|
||||||
|
// Log it if the log channel exists
|
||||||
|
DiscordChannel logChannel = await SupportChild.client.GetChannelAsync(Config.logChannel);
|
||||||
await logChannel.SendMessageAsync(new DiscordEmbedBuilder
|
await logChannel.SendMessageAsync(new DiscordEmbedBuilder
|
||||||
{
|
{
|
||||||
Color = DiscordColor.Green,
|
Color = DiscordColor.Green,
|
||||||
Description = staffMember.Mention + " was added to staff.\n"
|
Description = staffMember.Mention + " was added to staff.\n"
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
catch (NotFoundException)
|
||||||
|
{
|
||||||
|
Logger.Error("Could not find the log channel.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -7,6 +7,7 @@ using DSharpPlus.Commands;
|
||||||
using DSharpPlus.Commands.ContextChecks;
|
using DSharpPlus.Commands.ContextChecks;
|
||||||
using DSharpPlus.Commands.Processors.SlashCommands;
|
using DSharpPlus.Commands.Processors.SlashCommands;
|
||||||
using DSharpPlus.Entities;
|
using DSharpPlus.Entities;
|
||||||
|
using DSharpPlus.Exceptions;
|
||||||
using DSharpPlus.Interactivity;
|
using DSharpPlus.Interactivity;
|
||||||
using DSharpPlus.Interactivity.Extensions;
|
using DSharpPlus.Interactivity.Extensions;
|
||||||
|
|
||||||
|
@ -117,18 +118,20 @@ public class AdminCommands
|
||||||
Description = "Channel has been designated ticket " + ticketID + "."
|
Description = "Channel has been designated ticket " + ticketID + "."
|
||||||
});
|
});
|
||||||
|
|
||||||
// TODO: This throws an exception instead of returning null now
|
try
|
||||||
|
|
||||||
// Log it if the log channel exists
|
|
||||||
DiscordChannel logChannel = await command.Guild.GetChannelAsync(Config.logChannel);
|
|
||||||
if (logChannel != null)
|
|
||||||
{
|
{
|
||||||
|
// Log it if the log channel exists
|
||||||
|
DiscordChannel logChannel = await SupportChild.client.GetChannelAsync(Config.logChannel);
|
||||||
await logChannel.SendMessageAsync(new DiscordEmbedBuilder
|
await logChannel.SendMessageAsync(new DiscordEmbedBuilder
|
||||||
{
|
{
|
||||||
Color = DiscordColor.Green,
|
Color = DiscordColor.Green,
|
||||||
Description = command.Channel.Mention + " has been designated ticket " + ticketID + " by " + command.Member.Mention + "."
|
Description = command.Channel.Mention + " has been designated ticket " + ticketID + " by " + command.Member.Mention + "."
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
catch (NotFoundException)
|
||||||
|
{
|
||||||
|
Logger.Error("Could not find the log channel.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[RequireGuild]
|
[RequireGuild]
|
||||||
|
@ -175,18 +178,20 @@ public class AdminCommands
|
||||||
Description = "Channel has been undesignated as a ticket."
|
Description = "Channel has been undesignated as a ticket."
|
||||||
});
|
});
|
||||||
|
|
||||||
// TODO: This throws an exception instead of returning null now
|
try
|
||||||
|
|
||||||
// Log it if the log channel exists
|
|
||||||
DiscordChannel logChannel = await command.Guild.GetChannelAsync(Config.logChannel);
|
|
||||||
if (logChannel != null)
|
|
||||||
{
|
{
|
||||||
|
// Log it if the log channel exists
|
||||||
|
DiscordChannel logChannel = await SupportChild.client.GetChannelAsync(Config.logChannel);
|
||||||
await logChannel.SendMessageAsync(new DiscordEmbedBuilder
|
await logChannel.SendMessageAsync(new DiscordEmbedBuilder
|
||||||
{
|
{
|
||||||
Color = DiscordColor.Green,
|
Color = DiscordColor.Green,
|
||||||
Description = command.Channel.Mention + " has been undesignated as a ticket by " + command.Member.Mention + "."
|
Description = command.Channel.Mention + " has been undesignated as a ticket by " + command.Member.Mention + "."
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
catch (NotFoundException)
|
||||||
|
{
|
||||||
|
Logger.Error("Could not find the log channel.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -92,16 +92,19 @@ public class AssignCommand
|
||||||
catch (UnauthorizedException) { }
|
catch (UnauthorizedException) { }
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: This throws an exception instead of returning null now
|
try
|
||||||
// Log it if the log channel exists
|
|
||||||
DiscordChannel logChannel = await command.Guild.GetChannelAsync(Config.logChannel);
|
|
||||||
if (logChannel != null)
|
|
||||||
{
|
{
|
||||||
|
// Log it if the log channel exists
|
||||||
|
DiscordChannel logChannel = await SupportChild.client.GetChannelAsync(Config.logChannel);
|
||||||
await logChannel.SendMessageAsync(new DiscordEmbedBuilder
|
await logChannel.SendMessageAsync(new DiscordEmbedBuilder
|
||||||
{
|
{
|
||||||
Color = DiscordColor.Green,
|
Color = DiscordColor.Green,
|
||||||
Description = member.Mention + " was assigned to " + command.Channel.Mention + " by " + command.Member.Mention + "."
|
Description = member.Mention + " was assigned to " + command.Channel.Mention + " by " + command.Member.Mention + "."
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
catch (NotFoundException)
|
||||||
|
{
|
||||||
|
Logger.Error("Could not find the log channel.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -5,6 +5,7 @@ using DSharpPlus.Commands;
|
||||||
using DSharpPlus.Commands.ContextChecks;
|
using DSharpPlus.Commands.ContextChecks;
|
||||||
using DSharpPlus.Commands.Processors.SlashCommands;
|
using DSharpPlus.Commands.Processors.SlashCommands;
|
||||||
using DSharpPlus.Entities;
|
using DSharpPlus.Entities;
|
||||||
|
using DSharpPlus.Exceptions;
|
||||||
|
|
||||||
namespace SupportChild.Commands;
|
namespace SupportChild.Commands;
|
||||||
|
|
||||||
|
@ -34,17 +35,20 @@ public class BlacklistCommand
|
||||||
Description = "Blacklisted " + user.Mention + "."
|
Description = "Blacklisted " + user.Mention + "."
|
||||||
}, true);
|
}, true);
|
||||||
|
|
||||||
// TODO: This throws an exception instead of returning null now
|
try
|
||||||
// Log it if the log channel exists
|
|
||||||
DiscordChannel logChannel = await command.Guild.GetChannelAsync(Config.logChannel);
|
|
||||||
if (logChannel != null)
|
|
||||||
{
|
{
|
||||||
|
// Log it if the log channel exists
|
||||||
|
DiscordChannel logChannel = await SupportChild.client.GetChannelAsync(Config.logChannel);
|
||||||
await logChannel.SendMessageAsync(new DiscordEmbedBuilder
|
await logChannel.SendMessageAsync(new DiscordEmbedBuilder
|
||||||
{
|
{
|
||||||
Color = DiscordColor.Green,
|
Color = DiscordColor.Green,
|
||||||
Description = user.Mention + " was blacklisted from opening tickets by " + command.Member.Mention + "."
|
Description = user.Mention + " was blacklisted from opening tickets by " + command.Member.Mention + "."
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
catch (NotFoundException)
|
||||||
|
{
|
||||||
|
Logger.Error("Could not find the log channel.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (Exception)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
|
|
|
@ -83,12 +83,10 @@ public class CloseCommand
|
||||||
closeReason = "\nReason: " + cachedReason + "\n";
|
closeReason = "\nReason: " + cachedReason + "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: This throws an exception instead of returning null now
|
try
|
||||||
|
|
||||||
// Log it if the log channel exists
|
|
||||||
DiscordChannel logChannel = await interaction.Guild.GetChannelAsync(Config.logChannel);
|
|
||||||
if (logChannel != null)
|
|
||||||
{
|
{
|
||||||
|
// Log it if the log channel exists
|
||||||
|
DiscordChannel logChannel = await SupportChild.client.GetChannelAsync(Config.logChannel);
|
||||||
DiscordEmbed embed = new DiscordEmbedBuilder
|
DiscordEmbed embed = new DiscordEmbedBuilder
|
||||||
{
|
{
|
||||||
Color = DiscordColor.Green,
|
Color = DiscordColor.Green,
|
||||||
|
@ -104,6 +102,10 @@ public class CloseCommand
|
||||||
|
|
||||||
await logChannel.SendMessageAsync(message);
|
await logChannel.SendMessageAsync(message);
|
||||||
}
|
}
|
||||||
|
catch (NotFoundException)
|
||||||
|
{
|
||||||
|
Logger.Error("Could not find the log channel.");
|
||||||
|
}
|
||||||
|
|
||||||
if (Config.closingNotifications)
|
if (Config.closingNotifications)
|
||||||
{
|
{
|
||||||
|
@ -117,8 +119,7 @@ public class CloseCommand
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// TODO: This throws an exception instead of returning null now
|
DiscordUser staffMember = await SupportChild.client.GetUserAsync(ticket.creatorID);
|
||||||
DiscordMember staffMember = await interaction.Guild.GetMemberAsync(ticket.creatorID);
|
|
||||||
await using FileStream file = new FileStream(Transcriber.GetPath(ticket.id), FileMode.Open, FileAccess.Read);
|
await using FileStream file = new FileStream(Transcriber.GetPath(ticket.id), FileMode.Open, FileAccess.Read);
|
||||||
|
|
||||||
DiscordMessageBuilder message = new DiscordMessageBuilder();
|
DiscordMessageBuilder message = new DiscordMessageBuilder();
|
||||||
|
|
|
@ -268,19 +268,20 @@ public class NewCommand
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: This throws an exception instead of returning null now
|
try
|
||||||
|
|
||||||
// Log it if the log channel exists
|
|
||||||
DiscordChannel logChannel = await category.Guild.GetChannelAsync(Config.logChannel);
|
|
||||||
if (logChannel != null)
|
|
||||||
{
|
{
|
||||||
DiscordEmbed logMessage = new DiscordEmbedBuilder
|
// Log it if the log channel exists
|
||||||
|
DiscordChannel logChannel = await SupportChild.client.GetChannelAsync(Config.logChannel);
|
||||||
|
await logChannel.SendMessageAsync(new DiscordEmbedBuilder
|
||||||
{
|
{
|
||||||
Color = DiscordColor.Green,
|
Color = DiscordColor.Green,
|
||||||
Description = "Ticket " + ticketChannel.Mention + " opened by " + member.Mention + ".\n",
|
Description = "Ticket " + ticketChannel.Mention + " opened by " + member.Mention + ".\n",
|
||||||
Footer = new DiscordEmbedBuilder.EmbedFooter { Text = "Ticket " + ticketID }
|
Footer = new DiscordEmbedBuilder.EmbedFooter { Text = "Ticket " + ticketID }
|
||||||
};
|
});
|
||||||
await logChannel.SendMessageAsync(logMessage);
|
}
|
||||||
|
catch (NotFoundException)
|
||||||
|
{
|
||||||
|
Logger.Error("Could not find the log channel.");
|
||||||
}
|
}
|
||||||
|
|
||||||
return (true, "Ticket opened, " + member.Mention + "!\n" + ticketChannel.Mention);
|
return (true, "Ticket opened, " + member.Mention + "!\n" + ticketChannel.Mention);
|
||||||
|
|
|
@ -69,17 +69,20 @@ public class RandomAssignCommand
|
||||||
catch (UnauthorizedException) { }
|
catch (UnauthorizedException) { }
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: This throws an exception instead of returning null now
|
try
|
||||||
// Log it if the log channel exists
|
|
||||||
DiscordChannel logChannel = await command.Guild.GetChannelAsync(Config.logChannel);
|
|
||||||
if (logChannel != null)
|
|
||||||
{
|
{
|
||||||
|
// Log it if the log channel exists
|
||||||
|
DiscordChannel logChannel = await SupportChild.client.GetChannelAsync(Config.logChannel);
|
||||||
await logChannel.SendMessageAsync(new DiscordEmbedBuilder
|
await logChannel.SendMessageAsync(new DiscordEmbedBuilder
|
||||||
{
|
{
|
||||||
Color = DiscordColor.Green,
|
Color = DiscordColor.Green,
|
||||||
Description = staffMember.Mention + " was randomly assigned to " + command.Channel.Mention + " by " + command.Member.Mention + "."
|
Description = staffMember.Mention + " was randomly assigned to " + command.Channel.Mention + " by " + command.Member.Mention + "."
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
catch (NotFoundException)
|
||||||
|
{
|
||||||
|
Logger.Error("Could not find the log channel.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static async Task<DiscordMember> GetRandomVerifiedStaffMember(SlashCommandContext command, DiscordRole targetRole, Database.Ticket ticket)
|
private static async Task<DiscordMember> GetRandomVerifiedStaffMember(SlashCommandContext command, DiscordRole targetRole, Database.Ticket ticket)
|
||||||
|
|
|
@ -4,6 +4,7 @@ using DSharpPlus.Commands;
|
||||||
using DSharpPlus.Commands.ContextChecks;
|
using DSharpPlus.Commands.ContextChecks;
|
||||||
using DSharpPlus.Commands.Processors.SlashCommands;
|
using DSharpPlus.Commands.Processors.SlashCommands;
|
||||||
using DSharpPlus.Entities;
|
using DSharpPlus.Entities;
|
||||||
|
using DSharpPlus.Exceptions;
|
||||||
using MySqlConnector;
|
using MySqlConnector;
|
||||||
|
|
||||||
namespace SupportChild.Commands;
|
namespace SupportChild.Commands;
|
||||||
|
@ -39,16 +40,19 @@ public class RemoveStaffCommand
|
||||||
Description = "User was removed from staff."
|
Description = "User was removed from staff."
|
||||||
}, true);
|
}, true);
|
||||||
|
|
||||||
// TODO: This throws an exception instead of returning null now
|
try
|
||||||
// Log it if the log channel exists
|
|
||||||
DiscordChannel logChannel = await command.Guild.GetChannelAsync(Config.logChannel);
|
|
||||||
if (logChannel != null)
|
|
||||||
{
|
{
|
||||||
|
// Log it if the log channel exists
|
||||||
|
DiscordChannel logChannel = await SupportChild.client.GetChannelAsync(Config.logChannel);
|
||||||
await logChannel.SendMessageAsync(new DiscordEmbedBuilder
|
await logChannel.SendMessageAsync(new DiscordEmbedBuilder
|
||||||
{
|
{
|
||||||
Color = DiscordColor.Green,
|
Color = DiscordColor.Green,
|
||||||
Description = "User was removed from staff.\n"
|
Description = "User was removed from staff.\n"
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
catch (NotFoundException)
|
||||||
|
{
|
||||||
|
Logger.Error("Could not find the log channel.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -79,12 +79,11 @@ public class TranscriptCommand
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// TODO: This throws an exception instead of returning null now
|
|
||||||
|
|
||||||
// Log it if the log channel exists
|
try
|
||||||
DiscordChannel logChannel = await command.Guild.GetChannelAsync(Config.logChannel);
|
|
||||||
if (logChannel != null)
|
|
||||||
{
|
{
|
||||||
|
// Log it if the log channel exists
|
||||||
|
DiscordChannel logChannel = await SupportChild.client.GetChannelAsync(Config.logChannel);
|
||||||
await using FileStream file = new FileStream(Transcriber.GetPath(ticket.id), FileMode.Open, FileAccess.Read);
|
await using FileStream file = new FileStream(Transcriber.GetPath(ticket.id), FileMode.Open, FileAccess.Read);
|
||||||
|
|
||||||
DiscordMessageBuilder message = new DiscordMessageBuilder();
|
DiscordMessageBuilder message = new DiscordMessageBuilder();
|
||||||
|
@ -98,6 +97,10 @@ public class TranscriptCommand
|
||||||
|
|
||||||
await logChannel.SendMessageAsync(message);
|
await logChannel.SendMessageAsync(message);
|
||||||
}
|
}
|
||||||
|
catch (NotFoundException)
|
||||||
|
{
|
||||||
|
Logger.Error("Could not find the log channel.");
|
||||||
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
|
@ -4,6 +4,7 @@ using DSharpPlus.Commands;
|
||||||
using DSharpPlus.Commands.ContextChecks;
|
using DSharpPlus.Commands.ContextChecks;
|
||||||
using DSharpPlus.Commands.Processors.SlashCommands;
|
using DSharpPlus.Commands.Processors.SlashCommands;
|
||||||
using DSharpPlus.Entities;
|
using DSharpPlus.Entities;
|
||||||
|
using DSharpPlus.Exceptions;
|
||||||
|
|
||||||
namespace SupportChild.Commands;
|
namespace SupportChild.Commands;
|
||||||
|
|
||||||
|
@ -41,16 +42,19 @@ public class UnassignCommand
|
||||||
Description = "Unassigned staff member from ticket."
|
Description = "Unassigned staff member from ticket."
|
||||||
});
|
});
|
||||||
|
|
||||||
// TODO: This throws an exception instead of returning null now
|
try
|
||||||
// Log it if the log channel exists
|
|
||||||
DiscordChannel logChannel = await command.Guild.GetChannelAsync(Config.logChannel);
|
|
||||||
if (logChannel != null)
|
|
||||||
{
|
{
|
||||||
|
// Log it if the log channel exists
|
||||||
|
DiscordChannel logChannel = await SupportChild.client.GetChannelAsync(Config.logChannel);
|
||||||
await logChannel.SendMessageAsync(new DiscordEmbedBuilder
|
await logChannel.SendMessageAsync(new DiscordEmbedBuilder
|
||||||
{
|
{
|
||||||
Color = DiscordColor.Green,
|
Color = DiscordColor.Green,
|
||||||
Description = "Staff member was unassigned from " + command.Channel.Mention + " by " + command.Member.Mention + "."
|
Description = "Staff member was unassigned from " + command.Channel.Mention + " by " + command.Member.Mention + "."
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
catch (NotFoundException)
|
||||||
|
{
|
||||||
|
Logger.Error("Could not find the log channel.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -5,6 +5,7 @@ using DSharpPlus.Commands;
|
||||||
using DSharpPlus.Commands.ContextChecks;
|
using DSharpPlus.Commands.ContextChecks;
|
||||||
using DSharpPlus.Commands.Processors.SlashCommands;
|
using DSharpPlus.Commands.Processors.SlashCommands;
|
||||||
using DSharpPlus.Entities;
|
using DSharpPlus.Entities;
|
||||||
|
using DSharpPlus.Exceptions;
|
||||||
|
|
||||||
namespace SupportChild.Commands;
|
namespace SupportChild.Commands;
|
||||||
|
|
||||||
|
@ -33,17 +34,20 @@ public class UnblacklistCommand
|
||||||
Description = "Removed " + user.Mention + " from blacklist."
|
Description = "Removed " + user.Mention + " from blacklist."
|
||||||
}, true);
|
}, true);
|
||||||
|
|
||||||
// TODO: This throws an exception instead of returning null now
|
try
|
||||||
// Log it if the log channel exists
|
|
||||||
DiscordChannel logChannel = await command.Guild.GetChannelAsync(Config.logChannel);
|
|
||||||
if (logChannel != null)
|
|
||||||
{
|
{
|
||||||
|
// Log it if the log channel exists
|
||||||
|
DiscordChannel logChannel = await SupportChild.client.GetChannelAsync(Config.logChannel);
|
||||||
await logChannel.SendMessageAsync(new DiscordEmbedBuilder
|
await logChannel.SendMessageAsync(new DiscordEmbedBuilder
|
||||||
{
|
{
|
||||||
Color = DiscordColor.Green,
|
Color = DiscordColor.Green,
|
||||||
Description = user.Mention + " was unblacklisted from opening tickets by " + command.Member.Mention + "."
|
Description = user.Mention + " was unblacklisted from opening tickets by " + command.Member.Mention + "."
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
catch (NotFoundException)
|
||||||
|
{
|
||||||
|
Logger.Error("Could not find the log channel.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (Exception)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue