#Better way on removing commands?
1 messages · Page 1 of 1 (latest)
var commands = await DiscordSocketClient.Rest.Get(Guild|Global)ApplicationCommands()
foreach(var cmd in commands.Where(x => .....))
await cmd.DeleteAsync();
something like that
that just deletes commands...
alternatively you could do BulkOverwrite(Guild|Global)Commands
I actually created a method for html requests to delete a single command :)
// deletes single slash command
private async Task DeleteSlashCommand(ulong applicationId, ulong guildId, ulong commandId)
{
var httpClient = new HttpClient();
var httpRequestMessage = new HttpRequestMessage()
{
Method = HttpMethod.Delete,
RequestUri = new Uri($"https://discord.com/api/v6/applications/{applicationId}/guilds/{guildId}/commands/{commandId}")
};
httpRequestMessage.Headers.Add("Authorization", "Bot " + Environment.GetEnvironmentVariable("TOKEN"));
var response = await httpClient.SendAsync(httpRequestMessage);
Console.WriteLine(httpRequestMessage.ToString());
Console.WriteLine(response.StatusCode);
}
if that is something for you :D
i believe v6 is deprecated