discord.js-api
v9.5.2
Published
Discord API: An Overpowered Libarary For The Discord API.
Downloads
41
Maintainers
Readme
Discord.js-API
npm i discord.js-api
Usage:
const Discord require('discord-api');
const client = new Discord.client();
client.on('message', message => {
const args = message.content.slice(prefix.length).split(/ +/);
const command = args.shift().toLowerCase();
if (command === 'ping') {
message.channel.send('Pinging...')...').then(sent => {
sent.edit(`Pong! ${sent.createdTimestamp - message.createdTimestamp}ms`).catch(err => console.log(err));
console.log(`${message.author.username} used the ping command`);
} else if (command === 'server-emojis') {
const emojiList = message.guild.emojis.map(e=>e.toString()).join(' ');
message.channel.send(emojiList);
console.log(`${message.author.username} used the server-emojis command`);
if (emojiList === undefined || emojiList === null) {
message.channel.send('You Do Not Have Any Emojis In You Server!');
} else if (command === 'avatar') {
if (!message.mentions.users.size) {
return message.channel.send(`${message.author.displayAvatarURL}`);
}
const avatarList = message.mentions.users.map(user => {
return `${user.displayAvatarURL}`;
});
message.channel.send(avatarList).catch(err => console.log(err));
}
});
client.login(YOUR-TOKEN-HERE);