UNPKG

discord-client

Version:

Discord bot framework, create Discord bots with Discord.js better and faster.

31 lines (24 loc) 958 B
### discord-client Create Discord bots with Discord.js faster and better. ```javascript var Discord = require('discord-client'); var bot = new Discord('token'); bot.setPrefix('global', '!'); // Set the default prefix for each server to "!" bot.command('ping', {response: 'Pong!'}); // Create the command "ping", which will respond with "Pong!" bot.alias('ping', 'aliasname'); // Create an alias to "ping". bot.command('prefix', { execute: function(client, msg, args) { // Discord.js is able to be used while making more advanced commands if(msg.channel.permissionsFor(msg.author).hasPermission('MANAGE_GUILD')) { if(args.length <= 4) { bot.setPrefix(msg.guild.id, args); msg.reply('Changed the prefix to `' + args + '`'); } else { msg.reply('The prefix can\'t be over 4 characters!'); } } else { msg.reply('You need the permission `MANAGE_SERVER` to run this!'); } } }); bot.connect() ```