38 lines
No EOL
1.3 KiB
C#
38 lines
No EOL
1.3 KiB
C#
using System;
|
|
using System.Threading.Tasks;
|
|
using DSharpPlus.CommandsNext;
|
|
using DSharpPlus.CommandsNext.Attributes;
|
|
using DSharpPlus.Entities;
|
|
using Microsoft.Extensions.Logging;
|
|
|
|
namespace SupportChild.Commands
|
|
{
|
|
public class ReloadCommand : BaseCommandModule
|
|
{
|
|
[Command("reload")]
|
|
public async Task OnExecute(CommandContext command, [RemainingText] string commandArgs)
|
|
{
|
|
// Check if the user has permission to use this command.
|
|
if (!Config.HasPermission(command.Member, "reload"))
|
|
{
|
|
DiscordEmbed error = new DiscordEmbedBuilder
|
|
{
|
|
Color = DiscordColor.Red,
|
|
Description = "You do not have permission to use this command."
|
|
};
|
|
await command.RespondAsync(error);
|
|
command.Client.Logger.Log(LogLevel.Information, "User tried to use the reload command but did not have permission.");
|
|
return;
|
|
}
|
|
|
|
DiscordEmbed message = new DiscordEmbedBuilder
|
|
{
|
|
Color = DiscordColor.Green,
|
|
Description = "Reloading bot application..."
|
|
};
|
|
await command.RespondAsync(message);
|
|
Console.WriteLine("Reloading bot...");
|
|
SupportChild.instance.Reload();
|
|
}
|
|
}
|
|
} |