Added more detailed logging to log channel
This commit is contained in:
parent
b2c6478458
commit
f5852dae29
23 changed files with 316 additions and 36 deletions
|
@ -4,6 +4,7 @@ using DSharpPlus.Commands;
|
|||
using DSharpPlus.Commands.ContextChecks;
|
||||
using DSharpPlus.Commands.Processors.SlashCommands;
|
||||
using DSharpPlus.Entities;
|
||||
using DSharpPlus.Exceptions;
|
||||
|
||||
namespace SupportChild.Commands;
|
||||
|
||||
|
@ -72,5 +73,23 @@ public class AddCategoryCommand
|
|||
Description = "Error: Failed adding the category to the database."
|
||||
}, true);
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
DiscordChannel logChannel = await SupportChild.client.GetChannelAsync(Config.logChannel);
|
||||
await logChannel.SendMessageAsync(new DiscordEmbedBuilder
|
||||
{
|
||||
Color = DiscordColor.Green,
|
||||
Description = command.User.Mention + " added `" + category.Name + "` to the category list.",
|
||||
Footer = new DiscordEmbedBuilder.EmbedFooter
|
||||
{
|
||||
Text = "Category: " + title
|
||||
}
|
||||
});
|
||||
}
|
||||
catch (NotFoundException)
|
||||
{
|
||||
Logger.Error("Could not find the log channel.");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -18,7 +18,7 @@ public class AddCommand
|
|||
[Parameter("user")][Description("User to add to ticket.")] DiscordUser user)
|
||||
{
|
||||
// Check if ticket exists in the database
|
||||
if (!Database.IsOpenTicket(command.Channel.Id))
|
||||
if (!Database.TryGetOpenTicket(command.Channel.Id, out Database.Ticket ticket))
|
||||
{
|
||||
await command.RespondAsync(new DiscordEmbedBuilder
|
||||
{
|
||||
|
@ -62,7 +62,6 @@ public class AddCommand
|
|||
Description = "Added " + member.Mention + " to ticket."
|
||||
});
|
||||
|
||||
// Log it if the log channel exists
|
||||
try
|
||||
{
|
||||
DiscordChannel logChannel = await SupportChild.client.GetChannelAsync(Config.logChannel);
|
||||
|
@ -70,7 +69,11 @@ public class AddCommand
|
|||
{
|
||||
Color = DiscordColor.Green,
|
||||
Description = member.Mention + " was added to " + command.Channel.Mention +
|
||||
" by " + command.Member?.Mention + "."
|
||||
" by " + command.User.Mention + ".",
|
||||
Footer = new DiscordEmbedBuilder.EmbedFooter
|
||||
{
|
||||
Text = "Ticket: " + ticket.id.ToString("00000")
|
||||
}
|
||||
});
|
||||
}
|
||||
catch (NotFoundException)
|
||||
|
|
|
@ -4,6 +4,7 @@ using System.Threading.Tasks;
|
|||
using DSharpPlus.Commands;
|
||||
using DSharpPlus.Commands.ContextChecks;
|
||||
using DSharpPlus.Commands.Processors.SlashCommands;
|
||||
using DSharpPlus.Exceptions;
|
||||
|
||||
namespace SupportChild.Commands;
|
||||
|
||||
|
@ -52,5 +53,23 @@ public class AddMessageCommand
|
|||
Description = "Error: Failed adding the message to the database."
|
||||
}, true);
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
DiscordChannel logChannel = await SupportChild.client.GetChannelAsync(Config.logChannel);
|
||||
await logChannel.SendMessageAsync(new DiscordEmbedBuilder
|
||||
{
|
||||
Color = DiscordColor.Green,
|
||||
Description = command.User.Mention + " added or updated `" + identifier + "` in the /say command.\n\nContent:\n\n" + message,
|
||||
Footer = new DiscordEmbedBuilder.EmbedFooter
|
||||
{
|
||||
Text = "Identifier: " + identifier
|
||||
}
|
||||
});
|
||||
}
|
||||
catch (NotFoundException)
|
||||
{
|
||||
Logger.Error("Could not find the log channel.");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -65,7 +65,7 @@ public class AddStaffCommand
|
|||
await logChannel.SendMessageAsync(new DiscordEmbedBuilder
|
||||
{
|
||||
Color = DiscordColor.Green,
|
||||
Description = staffMember.Mention + " was added to staff.\n"
|
||||
Description = staffMember.Mention + " was added to staff by " + command.User.Mention + "."
|
||||
});
|
||||
}
|
||||
catch (NotFoundException)
|
||||
|
|
|
@ -115,11 +115,10 @@ public class AdminCommands
|
|||
DiscordUser ticketUser = (user == null ? command.User : user);
|
||||
|
||||
long id = Database.NewTicket(ticketUser.Id, 0, command.Channel.Id);
|
||||
string ticketID = id.ToString("00000");
|
||||
await command.RespondAsync(new DiscordEmbedBuilder
|
||||
{
|
||||
Color = DiscordColor.Green,
|
||||
Description = "Channel has been designated ticket " + ticketID + "."
|
||||
Description = "Channel has been designated ticket " + id.ToString("00000") + "."
|
||||
});
|
||||
|
||||
try
|
||||
|
@ -129,7 +128,11 @@ public class AdminCommands
|
|||
await logChannel.SendMessageAsync(new DiscordEmbedBuilder
|
||||
{
|
||||
Color = DiscordColor.Green,
|
||||
Description = command.Channel.Mention + " has been designated ticket " + ticketID + " by " + command.Member.Mention + "."
|
||||
Description = command.Channel.Mention + " has been designated ticket " + id.ToString("00000") + " by " + command.Member?.Mention + ".",
|
||||
Footer = new DiscordEmbedBuilder.EmbedFooter
|
||||
{
|
||||
Text = "Ticket: " + id.ToString("00000")
|
||||
}
|
||||
});
|
||||
}
|
||||
catch (NotFoundException)
|
||||
|
@ -189,7 +192,11 @@ public class AdminCommands
|
|||
await logChannel.SendMessageAsync(new DiscordEmbedBuilder
|
||||
{
|
||||
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.User.Mention + ".",
|
||||
Footer = new DiscordEmbedBuilder.EmbedFooter
|
||||
{
|
||||
Text = "Ticket: " + ticket.id.ToString("00000")
|
||||
}
|
||||
});
|
||||
}
|
||||
catch (NotFoundException)
|
||||
|
@ -217,6 +224,21 @@ public class AdminCommands
|
|||
Color = DiscordColor.Green,
|
||||
Description = "Reloading bot application..."
|
||||
});
|
||||
|
||||
try
|
||||
{
|
||||
DiscordChannel logChannel = await SupportChild.client.GetChannelAsync(Config.logChannel);
|
||||
await logChannel.SendMessageAsync(new DiscordEmbedBuilder
|
||||
{
|
||||
Color = DiscordColor.Green,
|
||||
Description = command.Channel.Mention + " reloaded the bot.",
|
||||
});
|
||||
}
|
||||
catch (NotFoundException)
|
||||
{
|
||||
Logger.Error("Could not find the log channel.");
|
||||
}
|
||||
|
||||
Logger.Log("Reloading bot...");
|
||||
await SupportChild.Reload();
|
||||
}
|
||||
|
@ -328,9 +350,22 @@ public class AdminCommands
|
|||
|
||||
await command.RespondAsync(new DiscordEmbedBuilder
|
||||
{
|
||||
|
||||
Color = DiscordColor.Green,
|
||||
Description = "Uploaded interview template."
|
||||
}, true);
|
||||
|
||||
try
|
||||
{
|
||||
DiscordChannel logChannel = await SupportChild.client.GetChannelAsync(Config.logChannel);
|
||||
await logChannel.SendMessageAsync(new DiscordEmbedBuilder
|
||||
{
|
||||
Color = DiscordColor.Green,
|
||||
Description = command.Channel.Mention + " uploaded new interview templates.",
|
||||
});
|
||||
}
|
||||
catch (NotFoundException)
|
||||
{
|
||||
Logger.Error("Could not find the log channel.");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -99,7 +99,11 @@ public class AssignCommand
|
|||
await logChannel.SendMessageAsync(new DiscordEmbedBuilder
|
||||
{
|
||||
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.User.Mention + ".",
|
||||
Footer = new DiscordEmbedBuilder.EmbedFooter
|
||||
{
|
||||
Text = "Ticket: " + ticket.id.ToString("00000")
|
||||
}
|
||||
});
|
||||
}
|
||||
catch (NotFoundException)
|
||||
|
|
|
@ -32,7 +32,7 @@ public class BlacklistCommand
|
|||
await command.RespondAsync(new DiscordEmbedBuilder
|
||||
{
|
||||
Color = DiscordColor.Green,
|
||||
Description = "Blacklisted " + user.Mention + "."
|
||||
Description = "Blocked " + user.Mention + " from opening new tickets."
|
||||
}, true);
|
||||
|
||||
try
|
||||
|
@ -42,7 +42,7 @@ public class BlacklistCommand
|
|||
await logChannel.SendMessageAsync(new DiscordEmbedBuilder
|
||||
{
|
||||
Color = DiscordColor.Green,
|
||||
Description = user.Mention + " was blacklisted from opening tickets by " + command.Member.Mention + "."
|
||||
Description = user.Mention + " was blocked from opening tickets by " + command.User.Mention + "."
|
||||
});
|
||||
}
|
||||
catch (NotFoundException)
|
||||
|
|
|
@ -92,7 +92,10 @@ public class CloseCommand
|
|||
Color = DiscordColor.Green,
|
||||
Description = "Ticket " + ticket.id.ToString("00000") + " closed by " +
|
||||
interaction.User.Mention + ".\n" + closeReason,
|
||||
Footer = new DiscordEmbedBuilder.EmbedFooter { Text = '#' + channelName }
|
||||
Footer = new DiscordEmbedBuilder.EmbedFooter
|
||||
{
|
||||
Text = "Ticket: " + ticket.id.ToString("00000")
|
||||
}
|
||||
};
|
||||
|
||||
await using FileStream file = new FileStream(Transcriber.GetPath(ticket.id), FileMode.Open, FileAccess.Read);
|
||||
|
@ -114,7 +117,10 @@ public class CloseCommand
|
|||
Color = DiscordColor.Green,
|
||||
Description = "Ticket " + ticket.id.ToString("00000") + " which you opened has now been closed, " +
|
||||
"check the transcript for more info.\n" + closeReason,
|
||||
Footer = new DiscordEmbedBuilder.EmbedFooter { Text = '#' + channelName }
|
||||
Footer = new DiscordEmbedBuilder.EmbedFooter
|
||||
{
|
||||
Text = "Ticket: " + ticket.id.ToString("00000")
|
||||
}
|
||||
};
|
||||
|
||||
try
|
||||
|
|
|
@ -6,6 +6,7 @@ using DSharpPlus.Commands;
|
|||
using DSharpPlus.Commands.ContextChecks;
|
||||
using DSharpPlus.Commands.Processors.SlashCommands;
|
||||
using DSharpPlus.Entities;
|
||||
using DSharpPlus.Exceptions;
|
||||
|
||||
namespace SupportChild.Commands;
|
||||
|
||||
|
@ -49,5 +50,19 @@ public class CreateButtonPanelCommand
|
|||
Color = DiscordColor.Green,
|
||||
Description = "Successfully created message, make sure to run this command again if you add new categories to the bot."
|
||||
}, true);
|
||||
|
||||
try
|
||||
{
|
||||
DiscordChannel logChannel = await SupportChild.client.GetChannelAsync(Config.logChannel);
|
||||
await logChannel.SendMessageAsync(new DiscordEmbedBuilder
|
||||
{
|
||||
Color = DiscordColor.Green,
|
||||
Description = command.User.Mention + " created a new button panel in " + command.Channel.Mention + "."
|
||||
});
|
||||
}
|
||||
catch (NotFoundException)
|
||||
{
|
||||
Logger.Error("Could not find the log channel.");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -6,6 +6,7 @@ using DSharpPlus.Commands;
|
|||
using DSharpPlus.Commands.ContextChecks;
|
||||
using DSharpPlus.Commands.Processors.SlashCommands;
|
||||
using DSharpPlus.Entities;
|
||||
using DSharpPlus.Exceptions;
|
||||
|
||||
namespace SupportChild.Commands;
|
||||
|
||||
|
@ -27,6 +28,20 @@ public class CreateSelectionBoxPanelCommand
|
|||
Color = DiscordColor.Green,
|
||||
Description = "Successfully created message, make sure to run this command again if you add new categories to the bot."
|
||||
}, true);
|
||||
|
||||
try
|
||||
{
|
||||
DiscordChannel logChannel = await SupportChild.client.GetChannelAsync(Config.logChannel);
|
||||
await logChannel.SendMessageAsync(new DiscordEmbedBuilder
|
||||
{
|
||||
Color = DiscordColor.Green,
|
||||
Description = command.User.Mention + " created a new selector panel in " + command.Channel.Mention + "."
|
||||
});
|
||||
}
|
||||
catch (NotFoundException)
|
||||
{
|
||||
Logger.Error("Could not find the log channel.");
|
||||
}
|
||||
}
|
||||
|
||||
public static async Task<List<DiscordSelectComponent>> GetSelectComponents(SlashCommandContext command, string placeholder)
|
||||
|
|
|
@ -20,7 +20,7 @@ public class MoveCommand
|
|||
[Parameter("category")][Description("The category to move the ticket to. Only has to be the beginning of the name.")] string category)
|
||||
{
|
||||
// Check if ticket exists in the database
|
||||
if (!Database.TryGetOpenTicket(command.Channel.Id, out Database.Ticket _))
|
||||
if (!Database.TryGetOpenTicket(command.Channel.Id, out Database.Ticket ticket))
|
||||
{
|
||||
await command.RespondAsync(new DiscordEmbedBuilder
|
||||
{
|
||||
|
@ -83,5 +83,23 @@ public class MoveCommand
|
|||
Color = DiscordColor.Green,
|
||||
Description = "Ticket was moved to `" + categoryChannel.Name + "`."
|
||||
});
|
||||
|
||||
try
|
||||
{
|
||||
DiscordChannel logChannel = await SupportChild.client.GetChannelAsync(Config.logChannel);
|
||||
await logChannel.SendMessageAsync(new DiscordEmbedBuilder
|
||||
{
|
||||
Color = DiscordColor.Green,
|
||||
Description = command.User.Mention + " moved " + command.Channel.Mention + " to `" + categoryChannel.Name + "`.",
|
||||
Footer = new DiscordEmbedBuilder.EmbedFooter
|
||||
{
|
||||
Text = "Ticket: " + ticket.id.ToString("00000")
|
||||
}
|
||||
});
|
||||
}
|
||||
catch (NotFoundException)
|
||||
{
|
||||
Logger.Error("Could not find the log channel.");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -166,11 +166,9 @@ public class NewCommand
|
|||
}
|
||||
|
||||
long id = Database.NewTicket(member.Id, staffID, ticketChannel.Id);
|
||||
string ticketID = id.ToString("00000");
|
||||
|
||||
try
|
||||
{
|
||||
await ticketChannel.ModifyAsync(modifiedAttributes => modifiedAttributes.Name = "ticket-" + ticketID);
|
||||
await ticketChannel.ModifyAsync(modifiedAttributes => modifiedAttributes.Name = "ticket-" + id.ToString("00000"));
|
||||
}
|
||||
catch (DiscordException e)
|
||||
{
|
||||
|
@ -245,8 +243,11 @@ public class NewCommand
|
|||
await logChannel.SendMessageAsync(new DiscordEmbedBuilder
|
||||
{
|
||||
Color = DiscordColor.Green,
|
||||
Description = "Ticket " + ticketChannel.Mention + " opened by " + member.Mention + ".\n",
|
||||
Footer = new DiscordEmbedBuilder.EmbedFooter { Text = "Ticket " + ticketID }
|
||||
Description = "Ticket " + ticketChannel.Mention + " opened by " + member.Mention + ".",
|
||||
Footer = new DiscordEmbedBuilder.EmbedFooter
|
||||
{
|
||||
Text = "Ticket: " + id.ToString("00000")
|
||||
}
|
||||
});
|
||||
}
|
||||
catch (NotFoundException)
|
||||
|
|
|
@ -76,7 +76,11 @@ public class RandomAssignCommand
|
|||
await logChannel.SendMessageAsync(new DiscordEmbedBuilder
|
||||
{
|
||||
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.User.Mention + ".",
|
||||
Footer = new DiscordEmbedBuilder.EmbedFooter
|
||||
{
|
||||
Text = "Ticket: " + ticket.id.ToString("00000")
|
||||
}
|
||||
});
|
||||
}
|
||||
catch (NotFoundException)
|
||||
|
|
|
@ -4,6 +4,7 @@ using DSharpPlus.Commands;
|
|||
using DSharpPlus.Commands.ContextChecks;
|
||||
using DSharpPlus.Commands.Processors.SlashCommands;
|
||||
using DSharpPlus.Entities;
|
||||
using DSharpPlus.Exceptions;
|
||||
|
||||
namespace SupportChild.Commands;
|
||||
|
||||
|
@ -13,9 +14,9 @@ public class RemoveCategoryCommand
|
|||
[Command("removecategory")]
|
||||
[Description("Removes the ability for users to open tickets in a specific category.")]
|
||||
public async Task OnExecute(SlashCommandContext command,
|
||||
[Parameter("category")][Description("The category to remove.")] DiscordChannel channel)
|
||||
[Parameter("category")][Description("The category to remove.")] DiscordChannel category)
|
||||
{
|
||||
if (!Database.TryGetCategory(channel.Id, out Database.Category _))
|
||||
if (!Database.TryGetCategory(category.Id, out Database.Category _))
|
||||
{
|
||||
await command.RespondAsync(new DiscordEmbedBuilder
|
||||
{
|
||||
|
@ -25,7 +26,7 @@ public class RemoveCategoryCommand
|
|||
return;
|
||||
}
|
||||
|
||||
if (Database.RemoveCategory(channel.Id))
|
||||
if (Database.RemoveCategory(category.Id))
|
||||
{
|
||||
await command.RespondAsync(new DiscordEmbedBuilder
|
||||
{
|
||||
|
@ -41,5 +42,20 @@ public class RemoveCategoryCommand
|
|||
Description = "Error: Failed removing the category from the database."
|
||||
}, true);
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
// Log it if the log channel exists
|
||||
DiscordChannel logChannel = await SupportChild.client.GetChannelAsync(Config.logChannel);
|
||||
await logChannel.SendMessageAsync(new DiscordEmbedBuilder
|
||||
{
|
||||
Color = DiscordColor.Green,
|
||||
Description = "`" + category.Name + "` was removed by " + command.User.Mention + "."
|
||||
});
|
||||
}
|
||||
catch (NotFoundException)
|
||||
{
|
||||
Logger.Error("Could not find the log channel.");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -4,6 +4,7 @@ using System.Threading.Tasks;
|
|||
using DSharpPlus.Commands;
|
||||
using DSharpPlus.Commands.ContextChecks;
|
||||
using DSharpPlus.Commands.Processors.SlashCommands;
|
||||
using DSharpPlus.Exceptions;
|
||||
|
||||
namespace SupportChild.Commands;
|
||||
|
||||
|
@ -41,5 +42,19 @@ public class RemoveMessageCommand
|
|||
Description = "Error: Failed removing the message from the database."
|
||||
}, true);
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
DiscordChannel logChannel = await SupportChild.client.GetChannelAsync(Config.logChannel);
|
||||
await logChannel.SendMessageAsync(new DiscordEmbedBuilder
|
||||
{
|
||||
Color = DiscordColor.Green,
|
||||
Description = "`" + identifier + "` was removed from the /say command by " + command.User.Mention + "."
|
||||
});
|
||||
}
|
||||
catch (NotFoundException)
|
||||
{
|
||||
Logger.Error("Could not find the log channel.");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -47,7 +47,7 @@ public class RemoveStaffCommand
|
|||
await logChannel.SendMessageAsync(new DiscordEmbedBuilder
|
||||
{
|
||||
Color = DiscordColor.Green,
|
||||
Description = "User was removed from staff.\n"
|
||||
Description = user.Mention + " was removed from staff by " + command.User.Mention + "."
|
||||
});
|
||||
}
|
||||
catch (NotFoundException)
|
||||
|
|
|
@ -3,15 +3,26 @@ using System.Threading.Tasks;
|
|||
using DSharpPlus.Commands;
|
||||
using DSharpPlus.Commands.Processors.SlashCommands;
|
||||
using DSharpPlus.Entities;
|
||||
using DSharpPlus.Exceptions;
|
||||
|
||||
namespace SupportChild.Commands;
|
||||
|
||||
public class RestartInterviewCommand
|
||||
{
|
||||
[Command("restartinterview")]
|
||||
[Description("Restarts the automated interview in this channel, using an updated template if available.")]
|
||||
[Description("Restarts the automated interview in this ticket, using an updated template if available.")]
|
||||
public async Task OnExecute(SlashCommandContext command)
|
||||
{
|
||||
if (!Database.TryGetOpenTicket(command.Channel.Id, out Database.Ticket ticket))
|
||||
{
|
||||
await command.RespondAsync(new DiscordEmbedBuilder
|
||||
{
|
||||
Color = DiscordColor.Red,
|
||||
Description = "This channel is not a ticket."
|
||||
}, true);
|
||||
return;
|
||||
}
|
||||
|
||||
await command.DeferResponseAsync(true);
|
||||
await Interviewer.RestartInterview(command);
|
||||
await command.RespondAsync(new DiscordEmbedBuilder
|
||||
|
@ -19,5 +30,23 @@ public class RestartInterviewCommand
|
|||
Color = DiscordColor.Green,
|
||||
Description = "Interview restarted."
|
||||
}, true);
|
||||
|
||||
try
|
||||
{
|
||||
DiscordChannel logChannel = await SupportChild.client.GetChannelAsync(Config.logChannel);
|
||||
await logChannel.SendMessageAsync(new DiscordEmbedBuilder
|
||||
{
|
||||
Color = DiscordColor.Green,
|
||||
Description = command.User.Mention + " restarted interview in " + command.Channel.Mention + ".",
|
||||
Footer = new DiscordEmbedBuilder.EmbedFooter
|
||||
{
|
||||
Text = "Ticket: " + ticket.id.ToString("00000")
|
||||
}
|
||||
});
|
||||
}
|
||||
catch (NotFoundException)
|
||||
{
|
||||
Logger.Error("Could not find the log channel.");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -5,6 +5,7 @@ using System.Threading.Tasks;
|
|||
using DSharpPlus.Commands;
|
||||
using DSharpPlus.Commands.ContextChecks;
|
||||
using DSharpPlus.Commands.Processors.SlashCommands;
|
||||
using DSharpPlus.Exceptions;
|
||||
using DSharpPlus.Interactivity;
|
||||
using DSharpPlus.Interactivity.Extensions;
|
||||
|
||||
|
@ -40,6 +41,20 @@ public class SayCommand
|
|||
Color = DiscordColor.Cyan,
|
||||
Description = message.message.Replace("\\n", "\n")
|
||||
});
|
||||
|
||||
try
|
||||
{
|
||||
DiscordChannel logChannel = await SupportChild.client.GetChannelAsync(Config.logChannel);
|
||||
await logChannel.SendMessageAsync(new DiscordEmbedBuilder
|
||||
{
|
||||
Color = DiscordColor.Green,
|
||||
Description = command.User.Mention + " posted the " + message.identifier + " message in " + command.Channel.Mention + "."
|
||||
});
|
||||
}
|
||||
catch (NotFoundException)
|
||||
{
|
||||
Logger.Error("Could not find the log channel.");
|
||||
}
|
||||
}
|
||||
|
||||
private static async void SendMessageList(SlashCommandContext command)
|
||||
|
|
|
@ -4,6 +4,7 @@ using DSharpPlus.Commands;
|
|||
using DSharpPlus.Commands.ContextChecks;
|
||||
using DSharpPlus.Commands.Processors.SlashCommands;
|
||||
using DSharpPlus.Entities;
|
||||
using DSharpPlus.Exceptions;
|
||||
using MySqlConnector;
|
||||
|
||||
namespace SupportChild.Commands;
|
||||
|
@ -17,7 +18,7 @@ public class SetSummaryCommand
|
|||
{
|
||||
ulong channelID = command.Channel.Id;
|
||||
// Check if ticket exists in the database
|
||||
if (!Database.TryGetOpenTicket(command.Channel.Id, out Database.Ticket _))
|
||||
if (!Database.TryGetOpenTicket(command.Channel.Id, out Database.Ticket ticket))
|
||||
{
|
||||
await command.RespondAsync(new DiscordEmbedBuilder
|
||||
{
|
||||
|
@ -41,5 +42,23 @@ public class SetSummaryCommand
|
|||
Color = DiscordColor.Green,
|
||||
Description = "Summary set."
|
||||
}, true);
|
||||
|
||||
try
|
||||
{
|
||||
DiscordChannel logChannel = await SupportChild.client.GetChannelAsync(Config.logChannel);
|
||||
await logChannel.SendMessageAsync(new DiscordEmbedBuilder
|
||||
{
|
||||
Color = DiscordColor.Green,
|
||||
Description = command.User.Mention + " set the summary for " + command.Channel.Mention + " to:\n\n" + summary,
|
||||
Footer = new DiscordEmbedBuilder.EmbedFooter
|
||||
{
|
||||
Text = "Ticket: " + ticket.id.ToString("00000")
|
||||
}
|
||||
});
|
||||
}
|
||||
catch (NotFoundException)
|
||||
{
|
||||
Logger.Error("Could not find the log channel.");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -4,6 +4,7 @@ using DSharpPlus.Commands;
|
|||
using DSharpPlus.Commands.ContextChecks;
|
||||
using DSharpPlus.Commands.Processors.SlashCommands;
|
||||
using DSharpPlus.Entities;
|
||||
using DSharpPlus.Exceptions;
|
||||
|
||||
namespace SupportChild.Commands;
|
||||
|
||||
|
@ -29,11 +30,24 @@ public class ToggleActiveCommand
|
|||
|
||||
if (Database.SetStaffActive(staffUser.Id, !staffMember.active))
|
||||
{
|
||||
await command.RespondAsync(new DiscordEmbedBuilder
|
||||
if (user != null && user.Id != command.User.Id)
|
||||
{
|
||||
Color = DiscordColor.Green,
|
||||
Description = staffMember.active ? "Staff member is now set as inactive and will no longer be randomly assigned any support tickets." : "Staff member is now set as active and will be randomly assigned support tickets again."
|
||||
}, true);
|
||||
await command.RespondAsync(new DiscordEmbedBuilder
|
||||
{
|
||||
Color = DiscordColor.Green,
|
||||
Description = staffUser.Mention + (staffMember.active ? " is now set as inactive and will no longer be randomly assigned any support tickets."
|
||||
: " is now set as active and will be randomly assigned support tickets again.")
|
||||
}, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
await command.RespondAsync(new DiscordEmbedBuilder
|
||||
{
|
||||
Color = DiscordColor.Green,
|
||||
Description = staffMember.active ? "You are now set as inactive and will no longer be randomly assigned any support tickets."
|
||||
: "You are now set as active and will be randomly assigned support tickets again."
|
||||
}, true);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -43,5 +57,31 @@ public class ToggleActiveCommand
|
|||
Description = "Error: Unable to update active status in database."
|
||||
}, true);
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
DiscordChannel logChannel = await SupportChild.client.GetChannelAsync(Config.logChannel);
|
||||
|
||||
if (user != null && user.Id != command.User.Id)
|
||||
{
|
||||
await logChannel.SendMessageAsync(new DiscordEmbedBuilder
|
||||
{
|
||||
Color = DiscordColor.Green,
|
||||
Description = staffUser.Mention + " set " + command.Channel.Mention + "'s status to " + (staffMember.active ? "active" : "inactive")
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
await logChannel.SendMessageAsync(new DiscordEmbedBuilder
|
||||
{
|
||||
Color = DiscordColor.Green,
|
||||
Description = staffUser.Mention + " set their own status to " + (staffMember.active ? "active" : "inactive")
|
||||
});
|
||||
}
|
||||
}
|
||||
catch (NotFoundException)
|
||||
{
|
||||
Logger.Error("Could not find the log channel.");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -90,8 +90,11 @@ public class TranscriptCommand
|
|||
message.AddEmbed(new DiscordEmbedBuilder
|
||||
{
|
||||
Color = DiscordColor.Green,
|
||||
Description = "Ticket " + ticket.id.ToString("00000") + " transcript generated by " + command.Member.Mention + ".\n",
|
||||
Footer = new DiscordEmbedBuilder.EmbedFooter { Text = '#' + command.Channel.Name }
|
||||
Description = "Transcript generated by " + command.User.Mention + ".",
|
||||
Footer = new DiscordEmbedBuilder.EmbedFooter
|
||||
{
|
||||
Text = "Ticket: " + ticket.id.ToString("00000")
|
||||
}
|
||||
});
|
||||
message.AddFiles(new Dictionary<string, Stream> { { Transcriber.GetFilename(ticket.id), file } });
|
||||
|
||||
|
|
|
@ -49,7 +49,11 @@ public class UnassignCommand
|
|||
await logChannel.SendMessageAsync(new DiscordEmbedBuilder
|
||||
{
|
||||
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.User.Mention + ".",
|
||||
Footer = new DiscordEmbedBuilder.EmbedFooter
|
||||
{
|
||||
Text = "Ticket: " + ticket.id.ToString("00000")
|
||||
}
|
||||
});
|
||||
}
|
||||
catch (NotFoundException)
|
||||
|
|
|
@ -31,7 +31,7 @@ public class UnblacklistCommand
|
|||
await command.RespondAsync(new DiscordEmbedBuilder
|
||||
{
|
||||
Color = DiscordColor.Green,
|
||||
Description = "Removed " + user.Mention + " from blacklist."
|
||||
Description = "Unblocked " + user.Mention + " from opening new tickets."
|
||||
}, true);
|
||||
|
||||
try
|
||||
|
@ -41,7 +41,7 @@ public class UnblacklistCommand
|
|||
await logChannel.SendMessageAsync(new DiscordEmbedBuilder
|
||||
{
|
||||
Color = DiscordColor.Green,
|
||||
Description = user.Mention + " was unblacklisted from opening tickets by " + command.Member.Mention + "."
|
||||
Description = user.Mention + " was unblocked from opening tickets by " + command.User.Mention + "."
|
||||
});
|
||||
}
|
||||
catch (NotFoundException)
|
||||
|
|
Loading…
Reference in a new issue