Answer the question
In order to leave comments, you need to log in
How do I get the Discord bot to profile the player?
I want my Discord bot (in javascript) to be able to show the player's profile with the !profile command. In the background there is some kind of photo and on top of it "stick" information about the person, an avatar and additional. info. It is necessary that, on command, the bot also writes down the participant’s information about himself and writes to his profile, and if possible, tell me how to make the bot’s level system (+ to write the level in the profile too).
I also ask you, tell me - is it possible to do something one (main) javascript file of the bot launches others that will perform some functions and how this is done.
const Discord = require ("discord.js");
const client = new Discord.Client();
client.login("token");
client.on("ready", () => {
client.user.setStatus('dnd');
client.user.setPresence({
game: {
name: 'В разработке!',
type: "STREAMING",
url: "https://www.twitch.tv/twitch"
}
});
//А дальше команды...
Answer the question
In order to leave comments, you need to log in
Any information about the user is stored in the database. Use to connect.
const mysql = require(`mysql`)
const connection = mysql.createConnection({
host: "",
user: "",
password: "",
database: ""
multipleStatements: true;
});
There is an even easier way, you take the necessary lines from the discord.js site and make a profile on them, here is an example:
const Discord = module.require("discord.js");
const fs = require("fs");
module.exports.run = async (bot,message,args) => {
let a = message.author
let embed = new Discord.RichEmbed()
.setDescription("Информация о сервере")
.setColor('#10c7e2')
.addField("Имя",a.username)
.addField("Тэг",a.tag)
.addField("Дискриминатор",a.discriminator)
.addField("Создание аккаунта",a.createdAt)
.addField("ID",a.id)
.addField("Вы бот?",a.bot)
.setThumbnail(a.avatarURL)
bot.send(embed);
};
module.exports.help = {
name: "userinfo"
};
client.on('message', message => {
if(message.content = `${prefix}userinfo`) {
const embed = new Discord.MessageEmbed()
.setTitle(`Информация о ${message.author.username}`)
.setColor(0xff0000)
.addField('Fullname | Полное имя', message.author.tag)
.addField('Тэг | Tag', message.author.discriminator)
.addField('Создан | Created', message.author.createdAt)
.addField('Идентификатор | ID', message.author.id)
message.channel.send(embed)
}
})
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question