Skip to content

Instantly share code, notes, and snippets.

@EasyThe
Created June 7, 2018 10:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save EasyThe/d9422e82e5dd51f64b626b03ce3db946 to your computer and use it in GitHub Desktop.
Save EasyThe/d9422e82e5dd51f64b626b03ce3db946 to your computer and use it in GitHub Desktop.
using Discord.Net.Providers.WS4Net;
using Discord.WebSocket;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Discord;
namespace ThothBot
{
class Program
{
DiscordSocketClient _client;
CommandHandler _handler;
static void Main(string[] args)
=> new Program().StartAsync().GetAwaiter().GetResult();
public async Task StartAsync()
{
if (Config.bot.token == "" || Config.bot.token == null) return;
_client = new DiscordSocketClient(new DiscordSocketConfig
{
LogLevel = LogSeverity.Verbose,
WebSocketProvider = WS4NetProvider.Instance
});
_client.Log += Log;
await _client.LoginAsync(TokenType.Bot, Config.bot.token);
await _client.StartAsync();
_handler = new CommandHandler();
await _handler.InitializeAsync(_client);
await Task.Delay(-1);
}
private async Task Log(LogMessage msg)
{
Console.WriteLine(msg.Message);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment