Dojnaz

z!HackBan

Dec 31st, 2018
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.84 KB | None | 0 0
  1. public async Task hackBan([Remainder]string input)
  2. {
  3.     try
  4.     {
  5.         string output = "```\n";
  6.         var inputs = input.Split(' ').ToList();
  7.         List<ulong> inp= new List<ulong>();
  8.         foreach (string x in inputs)
  9.         {
  10.             inp.Add(Convert.ToUInt64(x));
  11.         }
  12.  
  13.         foreach (ulong test in inp)
  14.         {
  15.             Console.WriteLine(test);
  16.         }
  17.  
  18.         if ((Context.User as SocketGuildUser).GuildPermissions.Administrator)
  19.         {
  20.             foreach (ulong line in inp)
  21.             {
  22.                 SocketUser currentUser = Context.Client.GetUser(Convert.ToUInt64(line));
  23.                 await Task.Delay(1000);
  24.                 Console.WriteLine(currentUser.Username);
  25.                 if ((currentUser as SocketGuildUser).GuildPermissions.Administrator)
  26.                 {
  27.                     output += $"Could not ban {line} ({currentUser.Username + "#" + currentUser.Discriminator})\n";
  28.                 }
  29.                 else
  30.                 {
  31.                     try
  32.                     {
  33.                         Context.Guild.AddBanAsync(currentUser, 0, $"Massbanned by {Context.User.Username + "#" + Context.User.Discriminator}");
  34.                         output += $"Sucessfully banned {line} ({currentUser.Username + "#" + currentUser.Discriminator})\n";
  35.                     }
  36.                     catch
  37.                     {
  38.                         output += $"Unable to ban {line} ({currentUser.Username + "#" + currentUser.Discriminator})\n";
  39.                     }
  40.                 }
  41.             }
  42.             Context.Channel.SendMessageAsync(output + "```");
  43.         }
  44.         else
  45.         {
  46.             await Context.Channel.SendMessageAsync("You don't have permission to run this command");
  47.         }
  48.     }
  49.     catch (Exception e)
  50.     {
  51.         ExceptionAlert(Context, e);
  52.     }
  53. }
Add Comment
Please, Sign In to add comment