Answer the question
In order to leave comments, you need to log in
How to link a js file to another one?
The matter is that I made a command, but I do not know what line to bind it.
Here is the index.js code:
const Discord = require('discord.js');
const client = new Discord.Client();
const { Client, MessageEmbed } = require('discord.js');
client.on('ready', () => {
console.log(`Logged in as ${client.user.tag}!`);
});
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"
};
Answer the question
In order to leave comments, you need to log in
the easiest way is to attach the command to the main bot file:
const Discord = require('discord.js');
const client = new Discord.Client();
const { Client, MessageEmbed } = require('discord.js');
client.on('ready', () => {
console.log(`Logged in as ${client.user.tag}!`);
});
client.on('message', (message) =>{
if (message.content == prefix+'userinfo'){
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)
message.channel.send(embed);
}
});
bot.login('your token');
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question