Created
April 2, 2018 12:25
-
-
Save zekroTJA/4b72e8c09c78c1472da8f94079751d7a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Pull Client class from discord.js | |
const { Client } = require('discord.js') | |
// Pull CmdParser class from discordjs-cmds | |
const { CmdParser } = require('discordjs-cmds') | |
// Create bot instance | |
const bot = new Client() | |
// Create CmdParser instance with passing bot and general prefix | |
const Cmd = new CmdParser(bot, '-') | |
// ------------------- C O M M A N D S ------------------- | |
function cmd_ping(msg, args) { | |
msg.channel.send('Pong! :ping_pong:') | |
} | |
function cmd_say(msg, args) { | |
msg.channel.send(args.join(' ')) | |
} | |
// ------------------------------------------------------- | |
// register commands | |
Cmd.register(cmd_ping, 'ping', ['pong'], 'Ping pong!', '`::ping`', Cmd.type.CHAT, 0) | |
.register(cmd_say, 'say', null, 'say somethign with the bot', '`::say <msg>`', null, 4) | |
// set options | |
Cmd.setOptions({ | |
msgcolor: 0x22d63a, | |
multilogfiles: 'logs', | |
ownerpermlvl: 5 | |
}) | |
// Set permission levels for specific roles | |
Cmd.setPerms('289901361951277056', 4) | |
// Set guild specific prefixes | |
Cmd.setGuildPres({ | |
'287535046762561536': '!' | |
}) | |
// set host account | |
Cmd.setHost(221905671296253953) | |
// register some events | |
Cmd.on('commandExecuted', (msg) => msg.send(`Command executed by <@${msg.member.id}>`)) | |
// Login and start bot loop | |
bot.login('Mjg3NTM4NDM1NjU1MjA0ODY0.DaOtZg.rQUK4CLKjoKMSIKTWXMSfcHZguM') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment