diff --git a/hydrabot/.gitignore b/hydrabot/.gitignore new file mode 100644 index 000000000..d344ba6b0 --- /dev/null +++ b/hydrabot/.gitignore @@ -0,0 +1 @@ +config.json diff --git a/hydrabot/README.md b/hydrabot/README.md index 5d0f750aa..dfaab46a1 100644 --- a/hydrabot/README.md +++ b/hydrabot/README.md @@ -1,2 +1,11 @@ # hydrabot Hydrabot is an open-source bot made with the intents of demonstrating the capabilities of [discord.js](https://github.com/hydrabolt/discord.js/). + +### Set up +The easiest setup would be to clone the discord.js repo, and then open a terminal/cmd in this directory and run `node hydrabot.js`. + +If you don't want to clone the repo but instead just use this folder, you need to edit `hydrabot.js` to use `require("discord.js")` as opposed to `require("../")`. Cloned directories will always be using the latest **discord.js**. + +### Setting up credentials + +Edit `config.json` to use your Discord email and password, and then run `node hydrabot.js`. diff --git a/hydrabot/hydrabot.js b/hydrabot/hydrabot.js new file mode 100644 index 000000000..4c0991f3c --- /dev/null +++ b/hydrabot/hydrabot.js @@ -0,0 +1,26 @@ +// If you did not clone discord.js, change the require parameter to `discord.js` +// and then run `npm install --save discord.js` in the same directory as this +// file. The bot should then run. +var Discord = require( "../" ); + +// Load the config file. If you have not already, make one that follows the +// structure : { "email" : "discordEmail", "password" : "discordPassword" } +var BotConfig = require( "./config.json" ); + +// Create a new Discord Client +var hydrabot = new Discord.Client(); + +// Log the client in using the auth details in config.json +hydrabot.login( BotConfig.email, BotConfig.password+"a" ); + +console.log("Starting up..."); + +// When the bot is ready to go, output to the console +hydrabot.on( "ready", function() { + console.log( "Ready!" ); +} ); + +// When the bot gets disconnected, exit. +hydrabot.on( "disconnected", function( obj ) { + console.log( "Disconnected", obj.reason ); +} );