2024-12-26 05:36:20 +00:00
|
|
|
|
using System.ComponentModel;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using DSharpPlus.Commands;
|
|
|
|
|
using DSharpPlus.Commands.ContextChecks;
|
|
|
|
|
using DSharpPlus.Commands.Processors.SlashCommands;
|
2022-02-21 08:40:09 +00:00
|
|
|
|
using DSharpPlus.Entities;
|
|
|
|
|
|
2022-08-21 07:34:11 +00:00
|
|
|
|
namespace SupportChild.Commands;
|
2022-02-21 08:40:09 +00:00
|
|
|
|
|
2024-12-26 05:36:20 +00:00
|
|
|
|
public class SummaryCommand
|
2022-08-21 07:34:11 +00:00
|
|
|
|
{
|
2024-12-26 05:36:20 +00:00
|
|
|
|
[RequireGuild]
|
|
|
|
|
[Command("summary")]
|
2024-12-26 12:57:41 +00:00
|
|
|
|
[Description("Shows ticket information and summary if there is one.")]
|
2024-12-26 05:36:20 +00:00
|
|
|
|
public async Task OnExecute(SlashCommandContext command)
|
2024-10-29 09:10:37 +00:00
|
|
|
|
{
|
2024-12-26 05:36:20 +00:00
|
|
|
|
if (!Database.TryGetOpenTicket(command.Channel.Id, out Database.Ticket ticket))
|
2024-10-29 09:10:37 +00:00
|
|
|
|
{
|
2024-12-26 05:36:20 +00:00
|
|
|
|
await command.RespondAsync(new DiscordEmbedBuilder
|
2024-10-29 09:10:37 +00:00
|
|
|
|
{
|
|
|
|
|
Color = DiscordColor.Red,
|
|
|
|
|
Description = "This channel is not a ticket."
|
|
|
|
|
}, true);
|
2024-12-26 05:36:20 +00:00
|
|
|
|
return;
|
2024-10-29 09:10:37 +00:00
|
|
|
|
}
|
2024-12-26 05:36:20 +00:00
|
|
|
|
|
|
|
|
|
DiscordEmbed channelInfo = new DiscordEmbedBuilder()
|
|
|
|
|
.WithTitle("Channel information")
|
|
|
|
|
.WithColor(DiscordColor.Cyan)
|
|
|
|
|
.AddField("Ticket number:", ticket.id.ToString("00000"), true)
|
|
|
|
|
.AddField("Ticket creator:", $"<@{ticket.creatorID}>", true)
|
|
|
|
|
.AddField("Assigned staff:", ticket.assignedStaffID == 0 ? "Unassigned." : $"<@{ticket.assignedStaffID}>", true)
|
|
|
|
|
.AddField("Creation time:", ticket.DiscordRelativeTime(), true)
|
|
|
|
|
.AddField("Summary:", string.IsNullOrEmpty(ticket.summary) ? "No summary." : ticket.summary.Replace("\\n", "\n"));
|
|
|
|
|
await command.RespondAsync(channelInfo);
|
2024-10-29 09:10:37 +00:00
|
|
|
|
}
|
2022-05-19 11:38:59 +00:00
|
|
|
|
}
|