diff --git a/Commands/AddStaffCommand.cs b/Commands/AddStaffCommand.cs index 016ea24..2191431 100644 --- a/Commands/AddStaffCommand.cs +++ b/Commands/AddStaffCommand.cs @@ -54,12 +54,23 @@ public class AddStaffCommand cmd.ExecuteNonQuery(); cmd.Dispose(); - await command.RespondAsync(new DiscordEmbedBuilder + if (alreadyStaff) { - Color = DiscordColor.Green, - Description = alreadyStaff ? staffMember.Mention + " is already a staff member, refreshed username in database." : staffMember.Mention + " was added to staff." - }, true); + await command.RespondAsync(new DiscordEmbedBuilder + { + Color = DiscordColor.Green, + Description = staffMember.Mention + " is already a staff member, refreshed username in database." + }, true); + } + else + { + await command.RespondAsync(new DiscordEmbedBuilder + { + Color = DiscordColor.Green, + Description = staffMember.Mention + " was added to staff." + }, true); - await LogChannel.Success(staffMember.Mention + " was added to staff by " + command.User.Mention + "."); + await LogChannel.Success(staffMember.Mention + " was added to staff by " + command.User.Mention + "."); + } } } \ No newline at end of file diff --git a/Commands/NewCommand.cs b/Commands/NewCommand.cs index 010eb63..ff07ead 100644 --- a/Commands/NewCommand.cs +++ b/Commands/NewCommand.cs @@ -11,7 +11,6 @@ using DSharpPlus.Exceptions; using SupportChild.Interviews; namespace SupportChild.Commands; - public class NewCommand { [RequireGuild] @@ -134,6 +133,11 @@ public class NewCommand return (false, "Error: Could not find the category to place the ticket in."); } + if (category.Children.Count == 50) + { + return (false, "This ticket category is full, can not create ticket channel."); + } + DiscordMember member = null; try { @@ -152,7 +156,10 @@ public class NewCommand { ticketChannel = await category.Guild.CreateChannelAsync("ticket", DiscordChannelType.Text, category); } - catch (Exception) { /* ignored */ } + catch (Exception e) + { + Logger.Error("Error occured while creating ticket.", e); + } if (ticketChannel == null) { @@ -174,7 +181,7 @@ public class NewCommand catch (DiscordException e) { Logger.Error("Exception occurred trying to modify channel: " + e); - Logger.Error("JsomMessage: " + e.JsonMessage); + Logger.Error("JsonMessage: " + e.JsonMessage); } try @@ -184,7 +191,7 @@ public class NewCommand catch (DiscordException e) { Logger.Error("Exception occurred trying to add channel permissions: " + e); - Logger.Error("JsomMessage: " + e.JsonMessage); + Logger.Error("JsonMessage: " + e.JsonMessage); } DiscordMessage message = await ticketChannel.SendMessageAsync("Hello, " + member.Mention + "!\n" + Config.welcomeMessage); @@ -231,7 +238,7 @@ public class NewCommand catch (DiscordException e) { Logger.Error("Exception occurred assign random staff member: " + e); - Logger.Error("JsomMessage: " + e.JsonMessage); + Logger.Error("JsonMessage: " + e.JsonMessage); } } } diff --git a/EventHandler.cs b/EventHandler.cs index 69abca6..8974c8c 100644 --- a/EventHandler.cs +++ b/EventHandler.cs @@ -288,7 +288,7 @@ public static class EventHandler catch (DiscordException ex) { Logger.Error("Interaction Exception occurred: " + ex); - Logger.Error("JsomMessage: " + ex.JsonMessage); + Logger.Error("JsonMessage: " + ex.JsonMessage); } catch (Exception ex) { diff --git a/LogChannel.cs b/LogChannel.cs index 391ad2e..2f550a3 100644 --- a/LogChannel.cs +++ b/LogChannel.cs @@ -38,25 +38,24 @@ public static class LogChannel try { - DiscordChannel logChannel = await SupportChild.client.GetChannelAsync(Config.logChannel); - - DiscordMessageBuilder messageBuilder = new(); DiscordEmbedBuilder embedBuilder = new() { Color = color, Description = message }; - if (ticketID != 0) { embedBuilder.WithFooter("Ticket: " + ticketID.ToString("00000")); } + DiscordMessageBuilder messageBuilder = new(); + messageBuilder.AddEmbed(embedBuilder); if (file != null) { messageBuilder.AddFile(file.fileName, file.contents); } + DiscordChannel logChannel = await SupportChild.client.GetChannelAsync(Config.logChannel); await logChannel.SendMessageAsync(messageBuilder); } catch (NotFoundException)