I am trying to make a bot with embedded messages, this is my app.js, embd.js and error.(我正在尝试制作一个嵌入消息的机器人,这是我的app.js,embed.js和错误。)
Note: Whenever I run the command I get the error, the command is supposed to be !embed, and it's supposed to return the code in the embed.js file.(注意:每当我运行命令时,都会出现错误,该命令应该被嵌入!并且应该返回embed.js文件中的代码。) Instead I get an @ and nothing else, If you wish to add me on discord my discord is GenerallyStevie#6166.(取而代之的是,我得到一个@,但没有其他提示,如果您希望将我加为不和,那么我的不和为GeneralStevie#6166。)
app.js code:(app.js代码:)
// Require discord.js package
const Discord = require("discord.js");
const embed = require("discord.js");
// Create a new client using the new keyword
const client = new Discord.Client();
const {
token
} = require("./token.json");
// Create array for clean code
const stringArray = ["ready", "reconnecting", "disconnect", "message", "!hello", "!help", "!embed"];
// Display a message when the bot comes online
client.on(stringArray[0], () => {
console.log(`Logged in as ${client.user.tag}!`);
});
// reconnecting event
client.on(stringArray[1], () => {
console.log(`This bot is reconnecting: ${client.user.tag}`);
});
// disconnect event
client.on(stringArray[2], () => {
console.log(`This bot is now disconnected: ${client.user.tag}`);
});
// Check for new messages
client.on(stringArray[3], msg => {
const toLower = msg.content.toLowerCase();
// Send back a reply when the specific command has been written by a user.
if (toLower === stringArray[4]){
msg.reply("Hello World!");
}
// !help command
else if (toLower === stringArray[5]){
msg.reply("The hello world bot has 2 commands. !hello !help");
}
if (toLower === stringArray[6]){
msg.reply(embed);
}
});
// Log in the bot using your token (password)
client.login(token);
embed.js code:(embed.js代码:)
const embedFile = require("./embed.js");
const embed = require("embed.js");
const exampleEmbed = new Discord.RichEmbed()
.setColor('#0099ff')
.setTitle('Some title')
.setURL('https://discord.js.org/')
.setAuthor('Some name', 'https://i.imgur.com/wSTFkRM.png', 'https://discord.js.org')
.setDescription('Some description here')
.setThumbnail('https://i.imgur.com/wSTFkRM.png')
.addField('Regular field title', 'Some value here')
.addBlankField()
.addField('Inline field title', 'Some value here', true)
.addField('Inline field title', 'Some value here', true)
.addField('Inline field title', 'Some value here', true)
.setImage('https://i.imgur.com/wSTFkRM.png')
.setTimestamp()
.setFooter('Some footer text here', 'https://i.imgur.com/wSTFkRM.png');
Image of what happens: https://prnt.sc/q43ae2(发生的情况的图像: https : //prnt.sc/q43ae2)
ask by GenerallyStevie translate from so
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…