public async Task UnbanUser(SocketGuild guild, ulong userID) { await Context.Message.DeleteAsync(); IUser user = (await guild.GetBansAsync()).Where(uid => uid.User.Id == userID).First().User; await guild.RemoveBanAsync(user); }
public async Task PeriodicCheckBan(TimeSpan interval, CancellationToken cancellationToken) { while (true) { Parallel.For(0, Data.Bans.Bans.Count, async index => { try { var current = Data.Bans.Bans.ElementAt(index); if (DateTime.UtcNow.ToBinary() >= long.Parse(current.Value)) { SocketGuild guild = _client.GetGuild(ulong.Parse(current.Key.Split(',')[1])); IUser user = null; foreach (IBan ban in await guild.GetBansAsync()) { if (ban.User.Id == ulong.Parse(current.Key.Split(',')[0])) { user = ban.User; } } await guild.RemoveBanAsync(user); Data.Bans.Remove(current.Key); } } catch { } }); await Task.Delay(interval, cancellationToken); } }
private async Task <OperationResult> RescindBanIfExpiredAsync ( ChannelLoggingService loggingService, BanService bans, SocketGuild guild, UserBan ban, CancellationToken ct ) { if (ct.IsCancellationRequested) { return(OperationResult.FromError("Operation was cancelled.")); } if (!(ban.ExpiresOn <= DateTime.UtcNow)) { // No rescinding is needed, so we'll just bail out return(OperationResult.FromSuccess()); } var rescinder = guild.GetUser(this.Client.CurrentUser.Id); var notifyResult = await loggingService.NotifyUserUnbannedAsync(ban, rescinder); if (!notifyResult.IsSuccess) { return(OperationResult.FromError(notifyResult)); } var deleteResult = await bans.DeleteBanAsync(ban, ct); if (!deleteResult.IsSuccess) { return(OperationResult.FromError(deleteResult)); } try { await guild.RemoveBanAsync((ulong)ban.User.DiscordID); } catch (HttpException hex) when(hex.HttpCode == HttpStatusCode.NotFound) { // Already unbanned return(OperationResult.FromSuccess()); } catch (Exception ex) { return(OperationResult.FromError(ex)); } return(OperationResult.FromSuccess()); }
public async Task UnBan(SocketGuild guild, UserModerationEntry?entry = null) { BannedUntil = null; if (!entry.HasValue) { SocketGuildUser self = guild.GetUser(BotCore.Client.CurrentUser.Id); entry = new UserModerationEntry(Parent.GuildId, ModerationType.UnBanned, null, self, "Automatic Unban"); } moderationEntries.Add(entry.Value); await Parent.InvokeUserModerationLogModifiedEvents(this, entry.Value); await Save(); await guild.RemoveBanAsync(UserId); }
public async Task <string> Unban(SocketGuild guild, ulong userId) { var ban = banRepo.GetUser(guild.Id, userId); if (ban != null) { await guild.RemoveBanAsync(userId); await banRepo.Unban(guild.Id, userId); var user = guild.GetUser(userId); return(user == null ? $"ID: {userId} unbanned." : $"{Formatter.FullName(user, true)} unbanned."); } else { var user = client.GetUser(userId); return($"{Formatter.FullName(user, true)} is not banned."); } }
public async Task unban(ulong Uid, ulong GuildId) { bCheck(); if (check != true) { return; } if (Context.Client.Guilds.Where(x => x.Id == GuildId).Count() < 1) { await Context.User.SendMessageAsync($":x: **I am not in a guild with id: {GuildId}**"); return; } SocketGuild Guild = Context.Client.Guilds.Where(x => x.Id == GuildId).FirstOrDefault(); try { await Guild.RemoveBanAsync(Uid); EmbedBuilder eb = new EmbedBuilder(); eb.WithAuthor($"Succesfull"); eb.WithColor(40, 200, 150); eb.WithDescription($":white_check_mark:**Unbanned user with id {Uid} in {Guild.Name} succesfully**"); eb.WithThumbnailUrl(Settings.MainThumbnailUrl); await Context.User.SendMessageAsync("", false, eb.Build()); string text = $"[{DateTime.UtcNow}] {Context.User.Username} used d!bunban command for user with id {Uid} in {Guild.Name}."; Console.WriteLine(text); await bLog(text); } catch (Exception ex) { EmbedBuilder eb = new EmbedBuilder(); eb.WithAuthor($"Error"); eb.WithColor(40, 200, 150); eb.WithDescription($":x:**Can't unban user with id {Uid} in {Guild.Name} {Environment.NewLine} Error: {ex.Message}**"); eb.WithThumbnailUrl(Settings.MainThumbnailUrl); await Context.User.SendMessageAsync("", false, eb.Build()); } }
public async Task <string> RelieveInfraction() { SocketGuild guild = BotCore.Client.GetGuild(GuildId); if (guild != null) { SocketGuildUser user = guild.GetUser(UserId); GuildModerationLog guildLog = GuildModerationLog.GetOrCreateGuildModerationLog(GuildId); UserModerationLog userLog = guildLog.GetOrCreateUserModerationLog(UserId); if (Type == ModerationType.Banned) { if (userLog.BannedUntil.HasValue) { if (userLog.BannedUntil.Value == Ends) { await guild.RemoveBanAsync(UserId); return(null); } } return("Banstate Invalid!"); } if (Type == ModerationType.Muted) { } return($"Unhandled timelimited moderation type `{Type}`"); } else { return($"Guild `{GuildId}` not found!"); } }
private async static Task <Task> ReadyApp() { Console.Clear(); Console.Title = "Discord Kira-Tool"; Console.WriteAscii("Discord Kira-Tool V.1", System.Drawing.Color.DeepPink); Console.WriteLine("By Seryû : https://github.com/Seryu-Ub" + Environment.NewLine, System.Drawing.Color.DeepPink); Console.WriteLine("--------------------------------------", System.Drawing.Color.MediumPurple); Console.WriteLine("Connecté sur l'utilisateur : " + _client.CurrentUser.Username + "#" + _client.CurrentUser.Discriminator, System.Drawing.Color.MediumPurple); Console.WriteLine("--------------------------------------" + Environment.NewLine, System.Drawing.Color.MediumPurple); Console.WriteLine("[1] Twitch Presence ##### [2] Playing Presence #### [3] Watching Presence #### [4] Listening Presence" + Environment.NewLine, System.Drawing.Color.HotPink); Console.WriteLine("[5] Envoyer un message ##### [6] Envoyer un embed #### [7] Bannir un utilisateur #### [8] Débannir un utilisateur" + Environment.NewLine, System.Drawing.Color.HotPink); string up = Console.ReadLine(); if (up == "1") { Console.Clear(); Console.Title = "Discord Kira-Tool | Twitch Presence"; Console.WriteAscii("Discord Kira-Tool V.1", System.Drawing.Color.DeepPink); Console.WriteLine("By Seryû : https://github.com/Seryu-Ub" + Environment.NewLine, System.Drawing.Color.DeepPink); Console.WriteLine("--------------------------------------", System.Drawing.Color.MediumPurple); Console.WriteLine("Connecté sur l'utilisateur : " + _client.CurrentUser.Username + "#" + _client.CurrentUser.Discriminator, System.Drawing.Color.MediumPurple); Console.WriteLine("--------------------------------------" + Environment.NewLine, System.Drawing.Color.MediumPurple); Console.WriteLine("Si vous voulez supprimer votre présence il suffit de ne rien écrire et de presser \"Entrée\"" + Environment.NewLine, System.Drawing.Color.Cyan); Console.WriteLine("Veuillez saisir le message de votre présence :" + Environment.NewLine, System.Drawing.Color.Cyan); string rpc = Console.ReadLine(); Console.WriteLine(Environment.NewLine + "Veuillez saisir votre lien twitch :" + Environment.NewLine, System.Drawing.Color.Cyan); string link = Console.ReadLine(); await _client.SetGameAsync(rpc, link, ActivityType.Streaming); Console.WriteLine(Environment.NewLine + "Votre présence a été changé avec succès !" + Environment.NewLine, System.Drawing.Color.MediumPurple); await Task.Delay(4000); await Program.ReadyApp(); } if (up == "2") { Console.Clear(); Console.Title = "Discord Kira-Tool | Playing Presence"; Console.WriteAscii("Discord Kira-Tool V.1", System.Drawing.Color.DeepPink); Console.WriteLine("By Seryû : https://github.com/Seryu-Ub" + Environment.NewLine, System.Drawing.Color.DeepPink); Console.WriteLine("--------------------------------------", System.Drawing.Color.MediumPurple); Console.WriteLine("Connecté sur l'utilisateur : " + _client.CurrentUser.Username + "#" + _client.CurrentUser.Discriminator, System.Drawing.Color.MediumPurple); Console.WriteLine("--------------------------------------" + Environment.NewLine, System.Drawing.Color.MediumPurple); Console.WriteLine("Si vous voulez supprimer votre présence il suffit de ne rien écrire et de presser \"Entrée\"" + Environment.NewLine, System.Drawing.Color.Cyan); Console.WriteLine("Veuillez saisir le message de votre présence :" + Environment.NewLine, System.Drawing.Color.Cyan); string rpc = Console.ReadLine(); await _client.SetActivityAsync(new Game(rpc, ActivityType.Playing)); Console.WriteLine(Environment.NewLine + "Votre présence a été changé avec succès !" + Environment.NewLine, System.Drawing.Color.MediumPurple); await Task.Delay(4000); await Program.ReadyApp(); } if (up == "3") { Console.Clear(); Console.Title = "Discord Kira-Tool | Watching Presence"; Console.WriteAscii("Discord Kira-Tool V.1", System.Drawing.Color.DeepPink); Console.WriteLine("By Seryû : https://github.com/Seryu-Ub" + Environment.NewLine, System.Drawing.Color.DeepPink); Console.WriteLine("--------------------------------------", System.Drawing.Color.MediumPurple); Console.WriteLine("Connecté sur l'utilisateur : " + _client.CurrentUser.Username + "#" + _client.CurrentUser.Discriminator, System.Drawing.Color.MediumPurple); Console.WriteLine("--------------------------------------", System.Drawing.Color.MediumPurple); Console.WriteLine("Si vous voulez supprimer votre présence il suffit de ne rien écrire et de presser \"Entrée\"" + Environment.NewLine, System.Drawing.Color.Cyan); Console.WriteLine("Veuillez saisir le message de votre présence :" + Environment.NewLine, System.Drawing.Color.Cyan); string rpc = Console.ReadLine(); await _client.SetActivityAsync(new Game(rpc, ActivityType.Watching)); Console.WriteLine(Environment.NewLine + "Votre présence a été changé avec succès !" + Environment.NewLine, System.Drawing.Color.MediumPurple); await Task.Delay(4000); await Program.ReadyApp(); } if (up == "4") { Console.Clear(); Console.Title = "Discord Kira-Tool | Listening Presence"; Console.WriteAscii("Discord Kira-Tool V.1", System.Drawing.Color.DeepPink); Console.WriteLine("By Seryû : https://github.com/Seryu-Ub" + Environment.NewLine, System.Drawing.Color.DeepPink); Console.WriteLine("--------------------------------------", System.Drawing.Color.MediumPurple); Console.WriteLine("Connecté sur l'utilisateur : " + _client.CurrentUser.Username + "#" + _client.CurrentUser.Discriminator, System.Drawing.Color.MediumPurple); Console.WriteLine("--------------------------------------" + Environment.NewLine, System.Drawing.Color.MediumPurple); Console.WriteLine("Si vous voulez supprimer votre présence il suffit de ne rien écrire et de presser \"Entrée\"" + Environment.NewLine, System.Drawing.Color.Cyan); Console.WriteLine("Veuillez saisir le message de votre présence :" + Environment.NewLine, System.Drawing.Color.Cyan); string rpc = Console.ReadLine(); await _client.SetActivityAsync(new Game(rpc, ActivityType.Listening)); Console.WriteLine(Environment.NewLine + "Votre présence a été changé avec succès !" + Environment.NewLine, System.Drawing.Color.MediumPurple); await Task.Delay(4000); await Program.ReadyApp(); } if (up == "5") { Console.Clear(); Console.Title = "Discord Kira-Tool | Envoyer un message"; Console.WriteAscii("Discord Kira-Tool V.1", System.Drawing.Color.DeepPink); Console.WriteLine("By Seryû : https://github.com/Seryu-Ub" + Environment.NewLine, System.Drawing.Color.DeepPink); Console.WriteLine("--------------------------------------", System.Drawing.Color.MediumPurple); Console.WriteLine("Connecté sur l'utilisateur : " + _client.CurrentUser.Username + "#" + _client.CurrentUser.Discriminator, System.Drawing.Color.MediumPurple); Console.WriteLine("--------------------------------------" + Environment.NewLine, System.Drawing.Color.MediumPurple); Console.WriteLine("Veuillez saisir votre message à envoyer :" + Environment.NewLine, System.Drawing.Color.Cyan); string message = ""; message = Console.ReadLine(); Console.WriteLine(Environment.NewLine + "Veuillez saisir l'id du channel où envoyer le message :" + Environment.NewLine); ulong channel = ulong.Parse(Console.ReadLine()); var chnl = _client.GetChannel(channel) as IMessageChannel; await chnl.SendMessageAsync(message); Console.WriteLine(Environment.NewLine + "Votre message a bien été envoyer !" + Environment.NewLine, System.Drawing.Color.MediumPurple); await Task.Delay(4000); await Program.ReadyApp(); } if (up == "6") { Console.Clear(); Console.Title = "Discord Kira-Tool | Envoyer un embed"; Console.WriteAscii("Discord Kira-Tool V.1", System.Drawing.Color.DeepPink); Console.WriteLine("By Seryû : https://github.com/Seryu-Ub" + Environment.NewLine, System.Drawing.Color.DeepPink); Console.WriteLine("--------------------------------------", System.Drawing.Color.MediumPurple); Console.WriteLine("Connecté sur l'utilisateur : " + _client.CurrentUser.Username + "#" + _client.CurrentUser.Discriminator, System.Drawing.Color.MediumPurple); Console.WriteLine("--------------------------------------" + Environment.NewLine, System.Drawing.Color.MediumPurple); Console.WriteLine("Veuillez saisir l'id du channel où envoyer le message :" + Environment.NewLine, System.Drawing.Color.Cyan); ulong channel = ulong.Parse(Console.ReadLine()); var chnl = _client.GetChannel(channel) as IMessageChannel; Console.WriteLine(Environment.NewLine + "Veuillez saisir un titre à l'embed (si vous ne voulez pas en mettre il suffit de ne rien écrire et de presser \"Entrée\") :" + Environment.NewLine, System.Drawing.Color.Cyan); string titre = ""; titre = Console.ReadLine(); Console.WriteLine(Environment.NewLine + "Veuillez saisir la description de l'embed (si vous ne voulez pas en mettre il suffit de ne rien écrire et de presser \"Entrée\") :" + Environment.NewLine, System.Drawing.Color.Cyan); string message = ""; message = Console.ReadLine(); Console.WriteLine(Environment.NewLine + "Veuillez saisir l'image de l'embed (si vous ne voulez pas en mettre il suffit de ne rien écrire et de presser \"Entrée\") :" + Environment.NewLine, System.Drawing.Color.Cyan); string image = ""; image = Console.ReadLine(); Console.WriteLine(Environment.NewLine + "Veuillez saisir le thumbnail de l'embed (si vous ne voulez pas en mettre il suffit de ne rien écrire et de presser \"Entrée\") :" + Environment.NewLine, System.Drawing.Color.Cyan); string thumbnail = ""; thumbnail = Console.ReadLine(); Console.WriteLine(Environment.NewLine + "Veuillez saisir le footer de l'embed (si vous ne voulez pas en mettre il suffit de ne rien écrire et de presser \"Entrée\") :" + Environment.NewLine, System.Drawing.Color.Cyan); string footer = ""; footer = Console.ReadLine(); Console.WriteLine(Environment.NewLine + "Couleur de l'embed [RGB] :" + Environment.NewLine, System.Drawing.Color.Cyan); byte r = byte.Parse(Console.ReadLine()); Console.WriteLine(Environment.NewLine + "Couleur de l'embed [RGB] :" + Environment.NewLine, System.Drawing.Color.Cyan); byte g = byte.Parse(Console.ReadLine()); Console.WriteLine(Environment.NewLine + "Couleur de l'embed [RGB] :" + Environment.NewLine, System.Drawing.Color.Cyan); byte b = byte.Parse(Console.ReadLine()); Console.WriteLine(Environment.NewLine + "Voulez vous activer le timestamp ? [Oui / Non] (Majuscule à la 1er lettre)" + Environment.NewLine, System.Drawing.Color.Cyan); string oi = Console.ReadLine(); if (oi == "Oui") { var builder = new EmbedBuilder() .WithTitle(titre) .WithDescription(message) .WithImageUrl(image) .WithThumbnailUrl(thumbnail) .WithColor(new Color(r, g, b)) .WithFooter(footer) .WithCurrentTimestamp(); var embed = builder.Build(); await chnl.SendMessageAsync(null, false, embed); } if (oi == "Non") { var builder = new EmbedBuilder() .WithTitle(titre) .WithDescription(message) .WithImageUrl(image) .WithThumbnailUrl(thumbnail) .WithColor(new Color(r, g, b)) .WithFooter(footer); var embed = builder.Build(); await chnl.SendMessageAsync(null, false, embed); } Console.WriteLine(Environment.NewLine + "Votre embed a bien été envoyer !" + Environment.NewLine, System.Drawing.Color.MediumPurple); await Task.Delay(4000); await Program.ReadyApp(); } if (up == "7") { Console.Clear(); Console.Title = "Discord Kira-Tool | Bannir un utilisateur"; Console.WriteAscii("Discord Kira-Tool V.1", System.Drawing.Color.DeepPink); Console.WriteLine("By Seryû : https://github.com/Seryu-Ub" + Environment.NewLine, System.Drawing.Color.DeepPink); Console.WriteLine("--------------------------------------", System.Drawing.Color.MediumPurple); Console.WriteLine("Connecté sur l'utilisateur : " + _client.CurrentUser.Username + "#" + _client.CurrentUser.Discriminator, System.Drawing.Color.MediumPurple); Console.WriteLine("--------------------------------------", System.Drawing.Color.MediumPurple); Console.WriteLine(Environment.NewLine + "[Vous (ou votre bot) devez avoir la permission de gerer les bannissements]" + Environment.NewLine, System.Drawing.Color.MediumPurple); Console.WriteLine("Veuillez saisir l'id du serveur ou ce trouve la personne que vous voulez bannir :" + Environment.NewLine, System.Drawing.Color.Cyan); ulong serv = ulong.Parse(Console.ReadLine()); Console.WriteLine(Environment.NewLine + "Veuillez saisir l'id de la personne que vous voulez bannir :" + Environment.NewLine, System.Drawing.Color.Cyan); ulong iduser = ulong.Parse(Console.ReadLine()); SocketGuild guild = _client.GetGuild(serv); foreach (SocketUser user in guild.Users) { try { await guild.AddBanAsync(iduser, 0, "Discord Kira-Tool"); } catch (Exception) { Console.WriteLine(Environment.NewLine + "Une erreur est survenue. Nous allons vous remettre sur la page principale.", System.Drawing.Color.Red); await Task.Delay(4000); return(await Program.ReadyApp()); } } Console.WriteLine(Environment.NewLine + "L'utilisateur a bien été banni !" + Environment.NewLine, System.Drawing.Color.MediumPurple); await Task.Delay(4000); await Program.ReadyApp(); } if (up == "8") { Console.Clear(); Console.Title = "Discord Kira-Tool | Débannir un utilisateur"; Console.WriteAscii("Discord Kira-Tool V.1", System.Drawing.Color.DeepPink); Console.WriteLine("By Seryû : https://github.com/Seryu-Ub" + Environment.NewLine, System.Drawing.Color.DeepPink); Console.WriteLine("--------------------------------------", System.Drawing.Color.MediumPurple); Console.WriteLine("Connecté sur l'utilisateur : " + _client.CurrentUser.Username + "#" + _client.CurrentUser.Discriminator, System.Drawing.Color.MediumPurple); Console.WriteLine("--------------------------------------", System.Drawing.Color.MediumPurple); Console.WriteLine(Environment.NewLine + "[Vous (ou votre bot) devez avoir la permission de gerer les bannissements]" + Environment.NewLine, System.Drawing.Color.MediumPurple); Console.WriteLine("Veuillez saisir l'id du serveur ou ce trouve la personne que vous voulez débannir :" + Environment.NewLine, System.Drawing.Color.Cyan); ulong serv = ulong.Parse(Console.ReadLine()); Console.WriteLine(Environment.NewLine + "Veuillez saisir l'id de la personne que vous voulez débannir :" + Environment.NewLine, System.Drawing.Color.Cyan); ulong iduser = ulong.Parse(Console.ReadLine()); SocketGuild guild = _client.GetGuild(serv); foreach (SocketUser user in guild.Users) { try { await guild.RemoveBanAsync(iduser); } catch (Exception) { Console.WriteLine(Environment.NewLine + "Une erreur est survenue. Nous allons vous remettre sur la page principale.", System.Drawing.Color.Red); await Task.Delay(4000); return(await Program.ReadyApp()); } } Console.WriteLine(Environment.NewLine + "L'utilisateur a bien été débanni !" + Environment.NewLine, System.Drawing.Color.MediumPurple); await Task.Delay(4000); await Program.ReadyApp(); } return(Task.CompletedTask); }
private void CheckTemporaryInfractions() { DateTime now = DateTime.UtcNow; SocketGuild guild = _client.GetGuild(_data.Configuration.GuildID); int resolvedCounter = 0; foreach (UserData user in _data.UserData.GetUsersWithTemporaryInfractions()) { if (user.HasTemporaryInfraction(TemporaryInfractionType.TempBan)) { TemporaryInfraction infraction = user.TemporaryInfractions.First(t => t.Type == TemporaryInfractionType.TempBan); if (infraction.Expire <= now) { guild.RemoveBanAsync(user.ID); _ = _modLog.CreateEntry(ModerationLogEntry.New .WithActionType(ModerationActionType.Unban) .WithTarget(user.ID) .WithReason("Temporary ban timed out.") .WithTime(DateTimeOffset.Now) .WithModerator(_client.CurrentUser)); user.TemporaryInfractions.RemoveAll(i => i.Type == TemporaryInfractionType.TempBan); resolvedCounter++; } } if (user.HasTemporaryInfraction(TemporaryInfractionType.TempMute)) { TemporaryInfraction infraction = user.TemporaryInfractions.First(t => t.Type == TemporaryInfractionType.TempMute); if (infraction.Expire <= now) { IRole mutedRole = guild.GetRole(_data.Configuration.MutedRoleID); // If the user is no longer in the server, just remove the entry, but don't attempt to remove his role. IGuildUser guildUser = guild.GetUser(user.ID); guildUser?.RemoveRoleAsync(mutedRole); user.Muted = false; _data.SaveUserData(); ModerationLogEntry entry = ModerationLogEntry.New .WithActionType(ModerationActionType.Unmute) .WithReason("Temporary mute timed out.") .WithTime(DateTimeOffset.Now) .WithModerator(_client.CurrentUser); if (guildUser != null) { entry = entry.WithTarget(guildUser); } else { entry = entry.WithTarget(user.ID); } _ = _modLog.CreateEntry(entry); user.TemporaryInfractions.RemoveAll(i => i.Type == TemporaryInfractionType.TempMute); resolvedCounter++; } } } if (resolvedCounter > 0) { _log.LogMessageAsync(new LogMessage(LogSeverity.Info, "TemporaryInfractions", $"Resolved {resolvedCounter} temporary infraction(s).")); _data.SaveUserData(); } }
public virtual Task RemoveBanAsync(IUser user, RequestOptions?options = null) { return(_socketGuild.RemoveBanAsync(user, options)); }
public Task RemoveBanAsync(IUser user, RequestOptions options = null) { return(Guild.RemoveBanAsync(user, options)); }
private async static Task <Task> ReadyAsync() { Console.Clear(); Console.Title = $" Discord Raider | {_client.CurrentUser.Username}#{_client.CurrentUser.Discriminator}"; Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine("Login succes : " + _client.CurrentUser.Username + "#" + _client.CurrentUser.Discriminator); System.Threading.Thread.Sleep(4700); Console.Clear(); Console.WriteLine("Login succes : " + _client.CurrentUser.Username + "#" + _client.CurrentUser.Discriminator); Console.ForegroundColor = ConsoleColor.Cyan; Console.WriteLine("\t\r\n\t ████████ ██████████ ██████ ██ ██ ████████ ██████ ██ ██████ ██████ ████████\r\n\t ██ ██ ██ ██ ████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██\r\n\t ██████ ██ ██████ ████████ ████████ ██████ ██ ██ ██ ████ ████████\r\n\t ██ ██ ██ ██ ██ ████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██\r\n\t ████████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██████ ██████ ██ ██\r\n\t\t\t\tBy Stanley & Rataka"); Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine("Hi " + _client.CurrentUser.Username + " This is the raid option ! (more option, write : EasterEGG and press enter)"); Console.ForegroundColor = ConsoleColor.DarkCyan; Console.WriteLine("___________________________________________________________________________________________________________________"); Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine("[1] Unban All (1.1) [4] Create mass text channel [7] Create mass voice channel [10] Unban Specific User "); Console.WriteLine("[2] DMALL [5] Give admin to all (1.1) [8] Rename all (1.1) [11] Twitch settings "); Console.WriteLine("[3] Delete all channel [6] List server [9] Ban all [12] Game settings "); Console.ForegroundColor = ConsoleColor.DarkCyan; Console.WriteLine("____________________________________________________________________________________________________________________"); Console.ForegroundColor = ConsoleColor.Green; string mas = Console.ReadLine(); if (mas == "EasterEGG") { Console.ForegroundColor = ConsoleColor.DarkCyan; Console.WriteLine("___________________________________________________________________________________________________________________"); Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine("Write : Credit"); Console.WriteLine("Write : ByStan"); Console.WriteLine("Write : ZelliDev"); Console.WriteLine("Write : Kirua"); Console.ForegroundColor = ConsoleColor.DarkCyan; Console.WriteLine("____________________________________________________________________________________________________________________"); Console.ReadKey(); await Program.ReadyAsync(); } if (mas == "Avaris") { await _client.SetGameAsync("A"); System.Threading.Thread.Sleep(1000); await _client.SetGameAsync("Av"); System.Threading.Thread.Sleep(1000); await _client.SetGameAsync("Ava"); System.Threading.Thread.Sleep(1000); await _client.SetGameAsync("Avar"); System.Threading.Thread.Sleep(1000); await _client.SetGameAsync("Avaris"); System.Threading.Thread.Sleep(1000); await Program.ReadyAsync(); } if (mas == "Zellidev") { Console.WriteLine("A candian programmer..."); await _client.SetGameAsync("Z"); System.Threading.Thread.Sleep(900); await _client.SetGameAsync("Ze"); System.Threading.Thread.Sleep(900); await _client.SetGameAsync("Zel"); System.Threading.Thread.Sleep(900); await _client.SetGameAsync("Zell"); System.Threading.Thread.Sleep(900); await _client.SetGameAsync("Zelly"); System.Threading.Thread.Sleep(900); await Program.ReadyAsync(); } if (mas == "Kirua") { Console.WriteLine("My Friend"); await _client.SetGameAsync("K"); System.Threading.Thread.Sleep(900); await _client.SetGameAsync("Ki"); System.Threading.Thread.Sleep(900); await _client.SetGameAsync("Kir"); System.Threading.Thread.Sleep(900); await _client.SetGameAsync("Kiru"); System.Threading.Thread.Sleep(900); await _client.SetGameAsync("Kirua"); System.Threading.Thread.Sleep(900); await Program.ReadyAsync(); } if (mas == "ByStan") { await _client.SetGameAsync("S"); System.Threading.Thread.Sleep(900); await _client.SetGameAsync("St"); System.Threading.Thread.Sleep(900); await _client.SetGameAsync("Sta"); System.Threading.Thread.Sleep(900); await _client.SetGameAsync("Stan"); System.Threading.Thread.Sleep(900); var fileStream = new FileStream(Directory.GetCurrentDirectory() + "/Stan.png", FileMode.Open); var image = new Image(fileStream); await _client.CurrentUser.ModifyAsync(u => u.Avatar = image); await Program.ReadyAsync(); } if (mas == "Credit") { Console.WriteLine("Devloppement : By Stanley#0001"); Console.WriteLine("Design : By Stanley#0001"); } if (mas == "12") { Console.Clear(); Console.WriteLine("Login succes : " + _client.CurrentUser.Username + "#" + _client.CurrentUser.Discriminator); Console.ForegroundColor = ConsoleColor.Cyan; Console.WriteLine("\t\r\n\t ████████ ██████████ ██████ ██ ██ ████████ ██████ ██ ██████ ██████ ████████\r\n\t ██ ██ ██ ██ ████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██\r\n\t ██████ ██ ██████ ████████ ████████ ██████ ██ ██ ██ ████ ████████\r\n\t ██ ██ ██ ██ ██ ████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██\r\n\t ████████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██████ ██████ ██ ██\r\n\t\t\t\tBy Stanley & Rataka"); Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine("Hi " + _client.CurrentUser.Username + " This is the raid option !"); Console.ForegroundColor = ConsoleColor.DarkCyan; Console.WriteLine("________________________________________________________________________________________________________________________"); Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine("[12] Game settings"); Console.ForegroundColor = ConsoleColor.DarkCyan; Console.WriteLine("________________________________________________________________________________________________________________________"); Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine("Wath is the game you wanna set? "); string name = Console.ReadLine(); await _client.SetGameAsync(name); await Program.ReadyAsync(); } if (mas == "11") { Console.Clear(); Console.WriteLine("Login succes : " + _client.CurrentUser.Username + "#" + _client.CurrentUser.Discriminator); Console.ForegroundColor = ConsoleColor.Cyan; Console.WriteLine("\t\r\n\t ████████ ██████████ ██████ ██ ██ ████████ ██████ ██ ██████ ██████ ████████\r\n\t ██ ██ ██ ██ ████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██\r\n\t ██████ ██ ██████ ████████ ████████ ██████ ██ ██ ██ ████ ████████\r\n\t ██ ██ ██ ██ ██ ████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██\r\n\t ████████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██████ ██████ ██ ██\r\n\t\t\t\tBy Stanley & Rataka"); Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine("Hi " + _client.CurrentUser.Username + " This is the raid option !"); Console.ForegroundColor = ConsoleColor.DarkCyan; Console.WriteLine("________________________________________________________________________________________________________________________"); Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine("[11] Twitch settings"); Console.ForegroundColor = ConsoleColor.DarkCyan; Console.WriteLine("________________________________________________________________________________________________________________________"); Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine("Que regardez vous ?"); string a = Console.ReadLine(); Console.WriteLine("Le lien twitch ?"); string b = Console.ReadLine(); await _client.SetGameAsync(a, b, StreamType.Twitch); await Program.ReadyAsync(); } if (mas == "10") { Console.Clear(); Console.WriteLine("Login succes : " + _client.CurrentUser.Username + "#" + _client.CurrentUser.Discriminator); Console.ForegroundColor = ConsoleColor.Cyan; Console.WriteLine("\t\r\n\t ████████ ██████████ ██████ ██ ██ ████████ ██████ ██ ██████ ██████ ████████\r\n\t ██ ██ ██ ██ ████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██\r\n\t ██████ ██ ██████ ████████ ████████ ██████ ██ ██ ██ ████ ████████\r\n\t ██ ██ ██ ██ ██ ████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██\r\n\t ████████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██████ ██████ ██ ██\r\n\t\t\t\tBy Stanley & Rataka"); Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine("Hi " + _client.CurrentUser.Username + " This is the raid option !"); Console.ForegroundColor = ConsoleColor.DarkCyan; Console.WriteLine("________________________________________________________________________________________________________________________"); Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine("[10] Unban Specific User"); Console.ForegroundColor = ConsoleColor.DarkCyan; Console.WriteLine("________________________________________________________________________________________________________________________"); Console.ForegroundColor = ConsoleColor.Green; Console.Write("Guild ID : "); string guildid2 = Console.ReadLine(); ulong id = Convert.ToUInt64(guildid2); Console.Write("User ID : "); string userID = Console.ReadLine(); ulong userid = Convert.ToUInt64(userID); SocketGuild guild = _client.GetGuild(id); foreach (SocketUser user in guild.Users) { try { await guild.RemoveBanAsync(userid); } catch (Exception) { } } await Program.ReadyAsync(); } if (mas == "9") { Console.Clear(); Console.WriteLine("Login succes : " + _client.CurrentUser.Username + "#" + _client.CurrentUser.Discriminator); Console.ForegroundColor = ConsoleColor.Cyan; Console.WriteLine("\t\r\n\t ████████ ██████████ ██████ ██ ██ ████████ ██████ ██ ██████ ██████ ████████\r\n\t ██ ██ ██ ██ ████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██\r\n\t ██████ ██ ██████ ████████ ████████ ██████ ██ ██ ██ ████ ████████\r\n\t ██ ██ ██ ██ ██ ████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██\r\n\t ████████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██████ ██████ ██ ██\r\n\t\t\t\tBy Stanley & Rataka"); Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine("Hi " + _client.CurrentUser.Username + " This is the raid option !"); Console.ForegroundColor = ConsoleColor.DarkCyan; Console.WriteLine("________________________________________________________________________________________________________________________"); Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine("[9] Ban all"); Console.ForegroundColor = ConsoleColor.DarkCyan; Console.WriteLine("________________________________________________________________________________________________________________________"); Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine("Guild ID : "); string guildid2 = Console.ReadLine(); ulong id = Convert.ToUInt64(guildid2); SocketGuild guild = _client.GetGuild(id); foreach (SocketUser user in guild.Users) { try { await guild.AddBanAsync(user, 0, "Using Stanraid"); } catch (Exception) { } } await Program.ReadyAsync(); } if (mas == "8") { Console.Clear(); Console.WriteLine("Login succes : " + _client.CurrentUser.Username + "#" + _client.CurrentUser.Discriminator); Console.ForegroundColor = ConsoleColor.Cyan; Console.WriteLine("\t\r\n\t ████████ ██████████ ██████ ██ ██ ████████ ██████ ██ ██████ ██████ ████████\r\n\t ██ ██ ██ ██ ████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██\r\n\t ██████ ██ ██████ ████████ ████████ ██████ ██ ██ ██ ████ ████████\r\n\t ██ ██ ██ ██ ██ ████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██\r\n\t ████████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██████ ██████ ██ ██\r\n\t\t\t\tBy Stanley & Rataka"); Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine("Hi " + _client.CurrentUser.Username + " This is the raid option !"); Console.ForegroundColor = ConsoleColor.DarkCyan; Console.WriteLine("________________________________________________________________________________________________________________________"); Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine("[8] ???????"); Console.ForegroundColor = ConsoleColor.DarkCyan; Console.WriteLine("________________________________________________________________________________________________________________________"); Console.ForegroundColor = ConsoleColor.Green; await Program.ReadyAsync(); } if (mas == "7") { Console.Clear(); Console.WriteLine("Login succes : " + _client.CurrentUser.Username + "#" + _client.CurrentUser.Discriminator); Console.ForegroundColor = ConsoleColor.Cyan; Console.WriteLine("\t\r\n\t ████████ ██████████ ██████ ██ ██ ████████ ██████ ██ ██████ ██████ ████████\r\n\t ██ ██ ██ ██ ████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██\r\n\t ██████ ██ ██████ ████████ ████████ ██████ ██ ██ ██ ████ ████████\r\n\t ██ ██ ██ ██ ██ ████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██\r\n\t ████████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██████ ██████ ██ ██\r\n\t\t\t\tBy Stanley & Rataka"); Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine("Hi " + _client.CurrentUser.Username + " This is the raid option !"); Console.ForegroundColor = ConsoleColor.DarkCyan; Console.WriteLine("________________________________________________________________________________________________________________________"); Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine("[7] Create mass voice channel"); Console.ForegroundColor = ConsoleColor.DarkCyan; Console.WriteLine("________________________________________________________________________________________________________________________"); Console.ForegroundColor = ConsoleColor.Green; Console.Write("Server ID : "); string guildid2 = Console.ReadLine(); Console.Write("Voice Channel Name : "); string textchan = Console.ReadLine(); ulong id = Convert.ToUInt64(guildid2); SocketGuild guild = _client.GetGuild(id); for (int i = 0; i < 100; i++) { try { await guild.CreateVoiceChannelAsync(textchan.Replace(' ', '-')); } catch (Exception) { } } await Program.ReadyAsync(); } if (mas == "6") { Console.Clear(); Console.WriteLine("Login succes : " + _client.CurrentUser.Username + "#" + _client.CurrentUser.Discriminator); Console.ForegroundColor = ConsoleColor.Cyan; Console.WriteLine("\t\r\n\t ████████ ██████████ ██████ ██ ██ ████████ ██████ ██ ██████ ██████ ████████\r\n\t ██ ██ ██ ██ ████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██\r\n\t ██████ ██ ██████ ████████ ████████ ██████ ██ ██ ██ ████ ████████\r\n\t ██ ██ ██ ██ ██ ████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██\r\n\t ████████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██████ ██████ ██ ██\r\n\t\t\t\tBy Stanley & Rataka"); Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine("Hi " + _client.CurrentUser.Username + " This is the raid option !"); Console.ForegroundColor = ConsoleColor.DarkCyan; Console.WriteLine("________________________________________________________________________________________________________________________"); Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine("[6] List Server"); Console.ForegroundColor = ConsoleColor.DarkCyan; Console.WriteLine("________________________________________________________________________________________________________________________"); Console.ForegroundColor = ConsoleColor.Green; foreach (var guild in _client.Guilds) { Console.WriteLine("+ Name : " + guild.Name + " | ID : " + guild.Id + " | Owner : " + guild.Owner); } Console.ReadKey(); await Program.ReadyAsync(); } if (mas == "5") { Console.Clear(); Console.WriteLine("Login succes : " + _client.CurrentUser.Username + "#" + _client.CurrentUser.Discriminator); Console.ForegroundColor = ConsoleColor.Cyan; Console.WriteLine("\t\r\n\t ████████ ██████████ ██████ ██ ██ ████████ ██████ ██ ██████ ██████ ████████\r\n\t ██ ██ ██ ██ ████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██\r\n\t ██████ ██ ██████ ████████ ████████ ██████ ██ ██ ██ ████ ████████\r\n\t ██ ██ ██ ██ ██ ████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██\r\n\t ████████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██████ ██████ ██ ██\r\n\t\t\t\tBy Stanley & Rataka"); Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine("Hi " + _client.CurrentUser.Username + " This is the raid option !"); Console.ForegroundColor = ConsoleColor.DarkCyan; Console.WriteLine("________________________________________________________________________________________________________________________"); Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine("[5] ???????"); Console.ForegroundColor = ConsoleColor.DarkCyan; Console.WriteLine("________________________________________________________________________________________________________________________"); Console.ForegroundColor = ConsoleColor.Green; await Program.ReadyAsync(); } if (mas == "4") { Console.Clear(); Console.WriteLine("Login succes : " + _client.CurrentUser.Username + "#" + _client.CurrentUser.Discriminator); Console.ForegroundColor = ConsoleColor.Cyan; Console.WriteLine("\t\r\n\t ████████ ██████████ ██████ ██ ██ ████████ ██████ ██ ██████ ██████ ████████\r\n\t ██ ██ ██ ██ ████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██\r\n\t ██████ ██ ██████ ████████ ████████ ██████ ██ ██ ██ ████ ████████\r\n\t ██ ██ ██ ██ ██ ████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██\r\n\t ████████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██████ ██████ ██ ██\r\n\t\t\t\tBy Stanley & Rataka"); Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine("Hi " + _client.CurrentUser.Username + " This is the raid option !"); Console.ForegroundColor = ConsoleColor.DarkCyan; Console.WriteLine("________________________________________________________________________________________________________________________"); Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine("[4] Create mass text channel"); Console.ForegroundColor = ConsoleColor.DarkCyan; Console.WriteLine("________________________________________________________________________________________________________________________"); Console.ForegroundColor = ConsoleColor.Green; Console.Write("Server ID : "); string guildid2 = Console.ReadLine(); Console.Write("Text Channel Name : "); string textchan = Console.ReadLine(); ulong id = Convert.ToUInt64(guildid2); SocketGuild guild = _client.GetGuild(id); for (int i = 0; i < 100; i++) { try { await guild.CreateTextChannelAsync(textchan.Replace(' ', '-')); } catch (Exception) { } } await Program.ReadyAsync(); } if (mas == "3") { Console.Clear(); Console.WriteLine("Login succes : " + _client.CurrentUser.Username + "#" + _client.CurrentUser.Discriminator); Console.ForegroundColor = ConsoleColor.Cyan; Console.WriteLine("\t\r\n\t ████████ ██████████ ██████ ██ ██ ████████ ██████ ██ ██████ ██████ ████████\r\n\t ██ ██ ██ ██ ████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██\r\n\t ██████ ██ ██████ ████████ ████████ ██████ ██ ██ ██ ████ ████████\r\n\t ██ ██ ██ ██ ██ ████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██\r\n\t ████████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██████ ██████ ██ ██\r\n\t\t\t\tBy Stanley & Rataka"); Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine("Hi " + _client.CurrentUser.Username + " This is the raid option !"); Console.ForegroundColor = ConsoleColor.DarkCyan; Console.WriteLine("________________________________________________________________________________________________________________________"); Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine("[3] Delete all channel"); Console.ForegroundColor = ConsoleColor.DarkCyan; Console.WriteLine("________________________________________________________________________________________________________________________"); Console.ForegroundColor = ConsoleColor.Green; Console.Write("Guild ID : "); string guildid2 = Console.ReadLine(); ulong id = Convert.ToUInt64(guildid2); SocketGuild guild = _client.GetGuild(id); foreach (SocketTextChannel chan in guild.TextChannels) { try { await chan.DeleteAsync(); } catch (Exception) { } } foreach (SocketVoiceChannel chanv in guild.VoiceChannels) { try { await chanv.DeleteAsync(); } catch (Exception) { } } await Program.ReadyAsync(); } if (mas == "2") { Console.Clear(); Console.WriteLine("Login succes : " + _client.CurrentUser.Username + "#" + _client.CurrentUser.Discriminator); Console.ForegroundColor = ConsoleColor.Cyan; Console.WriteLine("\t\r\n\t ████████ ██████████ ██████ ██ ██ ████████ ██████ ██ ██████ ██████ ████████\r\n\t ██ ██ ██ ██ ████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██\r\n\t ██████ ██ ██████ ████████ ████████ ██████ ██ ██ ██ ████ ████████\r\n\t ██ ██ ██ ██ ██ ████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██\r\n\t ████████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██████ ██████ ██ ██\r\n\t\t\t\tBy Stanley & Rataka"); Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine("Hi " + _client.CurrentUser.Username + " This is the raid option !"); Console.ForegroundColor = ConsoleColor.DarkCyan; Console.WriteLine("________________________________________________________________________________________________________________________"); Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine("[2] DMALL"); Console.ForegroundColor = ConsoleColor.DarkCyan; Console.WriteLine("________________________________________________________________________________________________________________________"); Console.ForegroundColor = ConsoleColor.Green; Console.Write("DMALL Message : "); string DMALL2 = Console.ReadLine(); foreach (SocketGuild guild in _client.Guilds) { foreach (SocketUser user in guild.Users) { try { await user.SendMessageAsync(DMALL2); } catch (Exception) { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("Cannot send : 1 : message"); } } await Program.ReadyAsync(); } } if (mas == "1") { Console.Clear(); Console.WriteLine("Login succes : " + _client.CurrentUser.Username + "#" + _client.CurrentUser.Discriminator); Console.ForegroundColor = ConsoleColor.Cyan; Console.WriteLine("\t\r\n\t ████████ ██████████ ██████ ██ ██ ████████ ██████ ██ ██████ ██████ ████████\r\n\t ██ ██ ██ ██ ████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██\r\n\t ██████ ██ ██████ ████████ ████████ ██████ ██ ██ ██ ████ ████████\r\n\t ██ ██ ██ ██ ██ ████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██\r\n\t ████████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██████ ██████ ██ ██\r\n\t\t\t\tBy Stanley & Rataka"); Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine("Hi " + _client.CurrentUser.Username + " This is the raid option !"); Console.ForegroundColor = ConsoleColor.DarkCyan; Console.WriteLine("________________________________________________________________________________________________________________________"); Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine("[1] Leave"); Console.ForegroundColor = ConsoleColor.DarkCyan; Console.WriteLine("________________________________________________________________________________________________________________________"); Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine("Leave message : "); } return(Task.CompletedTask); }
// Usage: (command) (user query) public override async Task Invoke(SocketGuild g, SocketMessage msg) { string[] line = msg.Content.Split(new char[] { ' ' }, 3, StringSplitOptions.RemoveEmptyEntries); string targetstr; if (line.Length < 2) { await SendUsageMessageAsync(msg.Channel, null); return; } targetstr = line[1]; // Retrieve target user var(targetId, targetData) = await GetUserDataFromString(g.Id, targetstr); if (targetId == 1) { await msg.Channel.SendMessageAsync(FailPrefix + FailDefault); return; } if (targetId == 0) { await SendUsageMessageAsync(msg.Channel, TargetNotFound); return; } string targetdisp; if (targetData != null) { targetdisp = $"{targetData.Username}#{targetData.Discriminator}"; } else { targetdisp = $"ID {targetId}"; } // Do the action try { await g.RemoveBanAsync(targetId); await msg.Channel.SendMessageAsync(string.Format(Success, targetdisp)); } catch (Discord.Net.HttpException ex) { if (ex.HttpCode == System.Net.HttpStatusCode.Forbidden) { await msg.Channel.SendMessageAsync(FailPrefix + Fail403); } else if (ex.HttpCode == System.Net.HttpStatusCode.NotFound) { await msg.Channel.SendMessageAsync(FailPrefix + Fail404); } else { await msg.Channel.SendMessageAsync(FailPrefix + FailDefault); await Log(ex.ToString()); } } }