Custom client for discord.js
Discord.CLIENT was created to simplify the wide use of Discord.js for beginners.
The first version was created by Eklavya11 at 15/09/2019.
Discord.js@11.x & above and Node.js@8.x & above is necessary to use Discord.CLIENT, to install:
- Node.js (Linux):
sudo apt-get install nodejs
- Node.js (Windows):
You can download Node.js here: nodejs.org
- Discord.js:
npm install --save discord.js (And make sure to have the this repo downloaded)
const Discord = require('discord.js');
const bot = new Discord.Client();
const { Client } = require('discord-client'); // or use src
bot.cli = new Client(bot);
bot.on('ready', () => {
bot.cli.setGame('I\'m online !');
console.log(`Logged in as ${bot.user.tag}!`);
});
bot.on('message', msg => {
if (msg.content === 'info') {
bot.cli.utils.findMember(msg, msg.author.id).then((res) => { // You can find a member with username instead of ID
let embed = new Discord.RichEmbed()
.setTitle(res.user.tag)
.setThumbnail(res.user.displayAvatarURL)
.addField('Name', res.user.username)
.addField('Tag', res.user.discriminator)
.addField('Bot', res.user.bot ? 'Yes' : 'No');
bot.cli.message.create({
to: msg.channel.id,
attachEmbed: embed
});
});
}
});
bot.login('token');