A discord bot implementation created with discord.js.
-
Download the discord-sailors folder.
-
Run the following command:
npm install -
Create a config.js file in the root folder as follow:
module.exports = { // The email of the discord account the bot will use to connect email: 'your email', // The password associated to the email password: 'your password', //plugin configurations plugins: {} } -
Run the following command:
npm start
-
Ping: no configuration
-
Team: no configuration
-
Dice: no configuration
-
Twitter:
twitter: { consumer_key: '123', consumer_secret: '123', access_token_key: '123', access_token_secret: '123' } -
Tumblr:
tumblr: { consumer_key: '123', consumer_secret: '123', token: '123', token_secret: '123' }
- Help
-
bot help:
bot replies with all available commands
-
- Ping
-
bot ping:
bot replies with the string pong
-
- Team
-
bot team param-number:
Given the current list of users in the channel (excluding the bot itself), bot separates the users into param1-number evenly splitted teams.
-
- Dice
- bot dice param1 param2:
- Twitter
- bot twitter track param1:
- bot twitter untrack param1:
- bot twitter tracklist:
- bot twitter last param1:
- bot twitter post param1:
- Tumblr
- bot tumblr post params:
We made the Sailors bot easily extensible. In order to add a new command you need to:
-
Create a new folder in commands. The name must not contain whitespaces.
-
Create a new file named index.js in the newly created folder. You have to export at least two methods:
- message(bot, message): whenever your command is called, the bot will invoke the message function. Add your command functionality here.
- help(): whenever the help command is called, the bot will invoke the help function in order to create the help string.
You can use the following template:
var debug = require("debug")('discord-sailors') var config = require('../../config'); var message = function(bot, message) { bot.reply(message, "pong"); } var help = function() { return "help string" } module.exports = { message: message, help: help }; -
If your command needs configuration, you should define it into config.js under the plugins attribute.