Advertisement
Guest User

Untitled

a guest
Mar 7th, 2017
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.82 KB | None | 0 0
  1. using Discord;
  2. using System;
  3. using System.Security;
  4. using System.Text;
  5.  
  6. namespace LaurensBot
  7. {
  8.     class Program
  9.     {
  10.         public static DiscordClient client;
  11.         static void Main(string[] args)
  12.         {
  13.             var login = GetLogin();
  14.             Console.Clear();
  15.             Console.WriteLine("Connecting to server...");
  16.             client = new DiscordClient();
  17.             client.Ready += Client_Ready;
  18.             client.MessageReceived += Client_MessageReceived;
  19.             client.Connect(login.Item1, login.Item2);
  20.             Console.ReadLine();
  21.         }
  22.  
  23.         private static void Client_Ready(object sender, EventArgs e)
  24.         {
  25.             Console.Clear();
  26.             Console.WriteLine("Bot connected to server!");
  27.         }
  28.  
  29.         public static Tuple<string, string> GetLogin()
  30.         {
  31.             Console.Write("Email: ");
  32.             var username = Console.ReadLine();
  33.  
  34.             Console.Write("Password: ");
  35.             var password = GetPassword();
  36.  
  37.             return new Tuple<string, string>(username, password.ToString());
  38.         }
  39.  
  40.         public static string GetPassword()
  41.         {
  42.             var pwd = new StringBuilder();
  43.             while (true)
  44.             {
  45.                 ConsoleKeyInfo i = Console.ReadKey(true);
  46.                 if (i.Key == ConsoleKey.Enter)
  47.                 {
  48.                     break;
  49.                 }
  50.                 else if (i.Key == ConsoleKey.Backspace)
  51.                 {
  52.                     if (pwd.Length > 0)
  53.                     {
  54.                         pwd.Remove(pwd.Length - 1, 1);
  55.                         Console.Write("\b \b");
  56.                     }
  57.                 }
  58.                 else
  59.                 {
  60.                     pwd.Append(i.KeyChar);
  61.                     Console.Write("*");
  62.                 }
  63.             }
  64.             return pwd.ToString();
  65.         }
  66.  
  67.         static string[] insults = new string[] {
  68.             "you smell like a bag of rotten potatoes.",
  69.             "you're almost as gay as jewus",
  70.             "you're so stupid",
  71.             "you have no friends",
  72.             "sorry, I can't hear how annoying you are",
  73.             "you're a failed abortion whose birth certificate is an apology from the condom factory",
  74.             "you must have been born on a highway, because that's where most accidents happen.",
  75.             "your family tree is a cactus, because everybody on it is a prick.",
  76.             "you're so ugly Hello Kitty said goodbye to you.",
  77.             "it looks like your face caught on fire and someone tried to put it out with a fork.",
  78.             "you are so ugly that when your mama dropped you off at school she got a fine for littering.",
  79.             "if you were twice as smart, you'd still be stupid.",
  80.             "do you have to leave so soon? I was just about to poison the tea.",
  81.             "you're so ugly when you popped out the doctor said aww what a treasure and your mom said yeah lets bury it",
  82.             "if your brain was made of chocolate it wouldn't fill an M&M"
  83.         };
  84.  
  85.         private static void Client_MessageReceived(object sender, MessageEventArgs e)
  86.         {
  87.             if (e.User == null || e.User.IsBot)
  88.                 return;
  89.  
  90.             if (e.Message.Text.StartsWith("+insult ") && e.Message.Text.Length > 8)
  91.             {
  92.                 var name = e.Message.Text.Substring(8);
  93.                 Random rnd = new Random();
  94.                 var insult = insults[rnd.Next(0, insults.Length)];
  95.                 e.Channel.SendMessage($"{name}, {insult}");
  96.             }
  97.         }
  98.     }
  99. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement