Skip to content

Instantly share code, notes, and snippets.

@willeccles
Created May 26, 2016 19:29
Show Gist options
  • Save willeccles/c813f4e79f54a7facd0d9df8907d6e0f to your computer and use it in GitHub Desktop.
Save willeccles/c813f4e79f54a7facd0d9df8907d6e0f to your computer and use it in GitHub Desktop.
// first create a client
client = new DiscordClient(bottoken, isbot);
// define events for the bot
// when the client connects...
client.Connected += (sender, e) => { ... };
// when a channel message has been recieved...
client.MessageReceived += (sender, e) => { ... };
// try to connect to the server
try
{
consolePrint("Attempting to connect to Discord...");
client.SendLoginRequest();
client.Connect();
consolePrint("Connected to Discord.");
} catch (Exception e)
{
consoleError(string.Format("Something went wrong while connecting to the server:\n{0}", e.Message));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment