Advertisement
Guest User

FishBot for Tatsumaki

a guest
Mar 9th, 2017
398
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.62 KB | None | 0 0
  1. using Discord;
  2. using System;
  3. using System.Text;
  4. using System.Threading.Tasks;
  5.  
  6. namespace LaurensBot
  7. {
  8.     class Program
  9.     {
  10.         public static DiscordClient client;
  11.  
  12.         static void Main(string[] args)
  13.         {
  14.             var login = GetLogin();
  15.             Console.Clear();
  16.             Console.WriteLine("Connecting to server...");
  17.             client = new DiscordClient();
  18.             client.Ready += Client_Ready;
  19.             client.Connect(login.Item1, login.Item2);
  20.  
  21.             for (;;) { Console.ReadKey(); }
  22.         }
  23.  
  24.         private static void Client_Ready(object sender, EventArgs e)
  25.         {
  26.             Console.Clear();
  27.             Console.WriteLine("Bot connected to server!");
  28.             Fish();
  29.         }
  30.  
  31.         private async static void Fish()
  32.         {
  33.             var msg = await client.GetChannel(254644234156638208).SendMessage("t!fish");
  34.             await Task.Delay(1000).ContinueWith((o) => msg.Delete());
  35.             await Task.Delay(30000).ContinueWith(((o) => Fish()));
  36.         }
  37.  
  38.         public static Tuple<string, string> GetLogin()
  39.         {
  40.             Console.Write("Email: ");
  41.             var username = Console.ReadLine();
  42.  
  43.             Console.Write("Password: ");
  44.             var password = GetPassword();
  45.  
  46.             return new Tuple<string, string>(username, password.ToString());
  47.         }
  48.  
  49.         public static string GetPassword()
  50.         {
  51.             var pwd = new StringBuilder();
  52.             while (true)
  53.             {
  54.                 ConsoleKeyInfo i = Console.ReadKey(true);
  55.                 if (i.Key == ConsoleKey.Enter)
  56.                 {
  57.                     break;
  58.                 }
  59.                 else if (i.Key == ConsoleKey.Backspace)
  60.                 {
  61.                     if (pwd.Length > 0)
  62.                     {
  63.                         pwd.Remove(pwd.Length - 1, 1);
  64.                         Console.Write("\b \b");
  65.                     }
  66.                 }
  67.                 else
  68.                 {
  69.                     pwd.Append(i.KeyChar);
  70.                     Console.Write("*");
  71.                 }
  72.             }
  73.             return pwd.ToString();
  74.         }
  75.     }
  76. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement