Add option to delete app commands on startup to discord bot
This commit is contained in:
parent
52a02abd3f
commit
8d32758918
|
@ -35,6 +35,12 @@ namespace BiblioTech
|
|||
Program.AdminChecker.SetAdminChannel(adminChannels.First());
|
||||
Program.RoleDriver = new RoleDriver(client, log, replacement);
|
||||
|
||||
if (Program.Config.DeleteCommandsAtStartup > 0)
|
||||
{
|
||||
log.Log("Deleting all application commands...");
|
||||
await guild.DeleteApplicationCommandsAsync();
|
||||
}
|
||||
|
||||
var builders = commands.Select(c =>
|
||||
{
|
||||
var msg = $"Building command '{c.Name}' with options: ";
|
||||
|
@ -54,6 +60,7 @@ namespace BiblioTech
|
|||
|
||||
try
|
||||
{
|
||||
log.Log("Creating application commands...");
|
||||
foreach (var builder in builders)
|
||||
{
|
||||
await guild.CreateApplicationCommandAsync(builder.Build());
|
||||
|
|
|
@ -38,6 +38,9 @@ namespace BiblioTech
|
|||
[Uniform("no-discord", "nd", "NODISCORD", false, "For debugging: Bypasses all Discord API calls.")]
|
||||
public int NoDiscord { get; set; } = 0;
|
||||
|
||||
[Uniform("delete-commands-at-startup", "dcas", "DELETECMDSATSTARTUP", false, "If > 0, deletes all app commands at startup.")]
|
||||
public int DeleteCommandsAtStartup { get; set; } = 0;
|
||||
|
||||
public string EndpointsPath => Path.Combine(DataPath, "endpoints");
|
||||
public string UserDataPath => Path.Combine(DataPath, "users");
|
||||
public string LogPath => Path.Combine(DataPath, "logs");
|
||||
|
|
Loading…
Reference in New Issue