2022-04-18 10:52:03 +00:00
|
|
|
|
using System;
|
2024-12-26 05:36:20 +00:00
|
|
|
|
using System.ComponentModel;
|
2022-02-21 08:40:09 +00:00
|
|
|
|
using System.Threading.Tasks;
|
2024-12-26 05:36:20 +00:00
|
|
|
|
using DSharpPlus.Commands;
|
|
|
|
|
using DSharpPlus.Commands.ContextChecks;
|
|
|
|
|
using DSharpPlus.Commands.Processors.SlashCommands;
|
2022-02-21 08:40:09 +00:00
|
|
|
|
using DSharpPlus.Entities;
|
2024-12-26 05:57:41 +00:00
|
|
|
|
using DSharpPlus.Exceptions;
|
2022-02-21 08:40:09 +00:00
|
|
|
|
|
2022-08-21 07:34:11 +00:00
|
|
|
|
namespace SupportChild.Commands;
|
|
|
|
|
|
2024-12-26 05:36:20 +00:00
|
|
|
|
public class UnblacklistCommand
|
2022-02-21 08:40:09 +00:00
|
|
|
|
{
|
2024-12-26 05:36:20 +00:00
|
|
|
|
[RequireGuild]
|
|
|
|
|
[Command("unblacklist")]
|
|
|
|
|
[Description("Unblacklists a user from opening tickets.")]
|
|
|
|
|
public async Task OnExecute(SlashCommandContext command, [Parameter("user")][Description("User to remove from blacklist.")] DiscordUser user)
|
2024-10-29 09:10:37 +00:00
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
if (!Database.Unblacklist(user.Id))
|
|
|
|
|
{
|
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 = user.Mention + " is not blacklisted."
|
|
|
|
|
}, true);
|
|
|
|
|
return;
|
|
|
|
|
}
|
2022-02-21 08:40:09 +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.Green,
|
2024-12-26 12:21:37 +00:00
|
|
|
|
Description = "Unblocked " + user.Mention + " from opening new tickets."
|
2024-10-29 09:10:37 +00:00
|
|
|
|
}, true);
|
2022-02-21 08:40:09 +00:00
|
|
|
|
|
2024-12-27 07:17:14 +00:00
|
|
|
|
await LogChannel.Success(user.Mention + " was unblocked from opening tickets by " + command.User.Mention + ".");
|
2024-10-29 09:10:37 +00:00
|
|
|
|
}
|
|
|
|
|
catch (Exception)
|
|
|
|
|
{
|
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 = "Error occured while removing " + user.Mention + " from blacklist."
|
|
|
|
|
}, true);
|
|
|
|
|
throw;
|
|
|
|
|
}
|
|
|
|
|
}
|
2022-05-19 11:38:59 +00:00
|
|
|
|
}
|