Advertisement
Guest User

Latest source

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