1.1.0 • Published 3 years ago
easier-discordbot v1.1.0
Easier Discord Bot!
Everyone can make a bot with this package!
Example code:
const easierDiscord = require('easier-discordbot');
// Create a Discord client
const bot = easierDiscord.createClient();
// Log in to your bot (change 'BOT TOKEN' with your own Discord bot token)
bot.login('BOT TOKEN');
// Change bot prefix (default prefix is '!')
bot.setPrefix('?');
// A Basic Command that replies with 'Pong!' when '?ping' is typed
bot.addCommand('ping', 'Pong!');
// Another Basic Command but has a cooldown of 2500 miliseconds (2.5 sec) this time
bot.addCommand('hello', 'Hello!', { cooldown: 2500 });
// A Function Command that replies with an embed with authors info when '?myinfo' is typed
bot.addCommand('myinfo', (msg) => {
var embed = easierDiscord.createMessageEmbed('Your Info', '#ffffff', 'Some basic information about your Discord Account:', {url: msg.author.avatarURL()}, {text: 'YOUR INFORMATION'})
.addField('Full Tag', msg.author.tag)
.addField('Username', msg.author.username)
.addField('Discriminator', msg.author.discriminator)
.addField('ID', msg.author.id);
if(msg.channel.type == 'text'){
embed.addField('Server Nickname', msg.member.displayName);
embed.addField('Highest Role', msg.member.roles.highest);
}
msg.channel.send(embed);
}, { cooldown: 5000 });