Advertisement
Guest User

bot2

a guest
Oct 13th, 2019
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.33 KB | None | 0 0
  1. using System;
  2. using System.Linq;
  3. using System.Threading.Tasks;
  4. using Discord;
  5. using Discord.WebSocket;
  6. using Discord.Commands;
  7. using DiscordBOT.Core;
  8. using System.IO;
  9.  
  10. namespace DiscordBOT
  11. {
  12.     class Program
  13.     {
  14.  
  15.         DiscordSocketClient _client;
  16.         CommandHandler _handler;
  17.  
  18.         static void Main(string[] args)
  19.             => new Program().StartAsync().GetAwaiter().GetResult();
  20.         /*{
  21.             if (args.Any() && args[0] == "-ver") Console.WriteLine(Utilities.GetAlert("VERSION"));
  22.         }*/
  23.  
  24.         public async Task StartAsync()
  25.         {
  26.  
  27.  
  28.             if (Config.bot.token == "" || Config.bot.token == null) return;
  29.             _client = new DiscordSocketClient(new DiscordSocketConfig
  30.             {
  31.                 LogLevel = LogSeverity.Verbose
  32.             });
  33.             _client.Log += Log;
  34.             _client.Ready += onInput.reqInput;
  35.  
  36.             await _client.LoginAsync(TokenType.Bot, Config.bot.token);
  37.             await _client.StartAsync();
  38.             Global.Client = _client;
  39.             _handler = new CommandHandler();
  40.             await _handler.InitializeAsync(_client);
  41.             await Task.Delay(-1);
  42.            
  43.         }
  44.  
  45.  
  46.  
  47.         private async Task Log(LogMessage msg)
  48.         {
  49.             Console.WriteLine(msg.Message);
  50.            
  51.         }
  52.     }
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement