Skip to content

Commands

Marko Kajzer edited this page Sep 7, 2019 · 3 revisions

You can add additional commands to the bot when using the bot as a dependency as described in the README.

// PongCommand.js
class PongCommand {
  constructor() {
    this.TRIGGERS = ['pong'];
  }

  run(message) {
    message.channel.send('Ping!');
  }
}

module.exports = PongCommand;

When starting the bot following the example from above, you can then pass additional commands as follows

// MyBot.js
const SoundBot = require('discord-soundbot');
const PongCommand = require('./PongCommand');

const pong = new PongCommand();

const myBot = new SoundBot({
  clientID: 'YOUR_CLIENT_ID',
  token: 'YOUR_BOT_USER_TOKEN'
}, [pong]);
myBot.start();
Clone this wiki locally