Answers for "discordjs"

2

discord.js

const Discord = require('discord.js');
const client = new Discord.Client();

client.on('ready', () => {
    console.log(`Logged in as ${client.user.tag}.`);
});

client.on('message', message => {
    if (message.content.toLowerCase() === 'ping') {
        message.channel.send('Pong');
    }
});

client.login('TOKEN');
Posted by: Guest on June-12-2021
0

discordjs

const Canvas = require("discord-canvas"),  Discord = require("discord.js"); const image = await new Canvas.RankCard()    .setAvatar("xixi52")    .setXP("current", 500)    .setXP("needed", 1000)    .setLevel(7)    .setRank(2)    .setReputation(450)    .setRankName("professional")    .setUsername("xixi52")    .setBadge(1, "gold")    .setBadge(3, "diamond")    .setBadge(5, "silver")    .setBadge(6, "bronze")    .setBackground("https://www.site.com/background.jpg")    .toAttachment(); const attachment = new Discord.MessageAttachment(image.toBuffer(), "rank-card.png"); message.channel.send(attachment);
Posted by: Guest on May-12-2021
0

discordjs

const Discord = require('discord.js');
const client = new Discord.Client();

client.on('ready', () => {
  console.log(`Logged in as ${client.user.tag}!`);
});

client.on('message', msg => {
  if (msg.content === 'ping') {
    msg.reply('Pong!');
  }
});

client.login('token');
Posted by: Guest on April-28-2021

Browse Popular Code Answers by Language