public async Task EMDEL(params string[] args) { if (args.Length == 0) { await ReplyAsync("", false, new EmbedBuilder { Title = "Emoji not provided", Description = $"Command Syntax: `{await SqliteClass.PrefixGetter(Context.Guild.Id)}emdelete emote_name`", Color = Color.Red }.WithCurrentTimestamp()); return; } if (await GetEmote(args[0]) == null) { await ReplyAsync("", false, new EmbedBuilder { Title = "Emoji not provided?", Description = $"Couldn't parse `{args[0]}` as an emote", Color = Color.Red }.WithCurrentTimestamp()); return; } var i = await GetEmote(args[0]); var cros = Emote.Parse("<a:cros:859032986166362152>"); var tickk = Emote.Parse("<a:tick:782831523400908832>"); var gc = Guid.NewGuid(); var cb = new ComponentBuilder().WithButton("", $"{gc}Tick", ButtonStyle.Secondary, tickk) .WithButton("", $"{gc}Cros", ButtonStyle.Secondary, cros); await Context.Channel.SendMessageAsync( $"Are you sure you want to delete {i}?\nThis is a potentially destructive action.", component : cb.Build()); var cancelSource = new CancellationTokenSource(); cancelSource.CancelAfter(15000); var Interaction = await InteractionHandler.NextButtonAsync( k => k.Data.CustomId.Contains(gc.ToString()) && k.User.Id == Context.User.Id, cancelSource.Token); if (Interaction == null) { await ReplyAsync("No response received!"); return; } await Interaction.AcknowledgeAsync(); var isTick = Interaction.Data.CustomId.Contains("Tick"); if (!isTick) { await Context.Channel.SendMessageAsync("", false, new EmbedBuilder { Title = "Alright then...", Color = Blurple, ImageUrl = "https://i.imgur.com/RBC7KUt.png" }.WithCurrentTimestamp().Build()); return; } var in_ = i.Name; await Context.Guild.DeleteEmoteAsync(i); await ReplyAsync("", false, new EmbedBuilder { Title = "Action successful!", Description = $"`:{in_}:` was deleted successfully!", Color = Blurple }.WithCurrentTimestamp()); }
public async Task CatDel(params string[] aa) { if (aa.Length == 0) { aa = new[] { Context.Channel.Id.ToString() } } ; var alf = GetCategory(aa[0]); if (alf == null) { await ReplyAsync("", false, new EmbedBuilder { Title = "Invalid category", Description = $"`{aa}` could not be parsed as category!", Color = Color.Red }.WithCurrentTimestamp()); return; } var cros = Emote.Parse("<a:cros:859032986166362152>"); var tickk = Emote.Parse("<a:tick:782831523400908832>"); var gc = Guid.NewGuid(); var cb = new ComponentBuilder().WithButton("", $"{gc}Tick", ButtonStyle.Secondary, tickk) .WithButton("", $"{gc}Cros", ButtonStyle.Secondary, cros); var ram = await Context.Channel.SendMessageAsync( $"Are you sure you want to delete `{alf.Name}`?\nThis is a potentially destructive action.", component : cb.Build()); var cancelSource = new CancellationTokenSource(); cancelSource.CancelAfter(15000); var Interaction = await InteractionHandler.NextButtonAsync( k => k.Data.CustomId.Contains(gc.ToString()) && k.User.Id == Context.User.Id, cancelSource.Token); if (Interaction == null) { await Context.Channel.SendMessageAsync("No response received!"); return; } var isTick = Interaction.Data.CustomId.Contains("Tick"); await Interaction.AcknowledgeAsync(); if (!isTick) { await Context.Channel.SendMessageAsync("", false, new EmbedBuilder { Title = "Alright then...", Color = Blurple, ImageUrl = "https://i.imgur.com/RBC7KUt.png" }.WithCurrentTimestamp().Build()); return; } foreach (var ch in alf.Channels) { await ch.DeleteAsync(); } await alf.DeleteAsync(); try { await ReplyAsync("", false, new EmbedBuilder { Title = "Action successful!", Description = $"<#{alf.Id}> was deleted along with all its channels", Color = Blurple }.WithCurrentTimestamp()); } catch { Console.WriteLine("Cat del'd"); } } }