問題描述
client.on("message", (message) => {
message.channel.send({
embed: {
color: 3447003,
author: {
name: client.user.username,
icon_url: client.user.avatarURL
},
title: "commands",
description: "all current commands",
fields: [{
name: "admin only",
value: "ban"
},
{
name: "moderator only",
value: "kick"
},
{
name: "everyone",
value: "ping
help
invite
sinvite
gay
owner "
}],
timestamp: new Date(),
footer: {
icon_url: client.user.avatarURL,
text: "~Isabelle~"
}
}
});
^
SyntaxError; Unexpected end of input
我在 node.js 中使用 discord.js,但我不確定是什么導致了這個錯誤.我已經(jīng)嘗試檢查是否有錯別字,但我沒有發(fā)現(xiàn)任何錯別字.幫忙?
I'm using discord.js within node.js, and I'm unsure what's causing this error. I've tried checking back for typos but I haven't caught any. Help?
推薦答案
如注釋中所述,將 });
添加到代碼的最后.這應該關(guān)閉 client.on
事件監(jiān)聽器.代碼中的最后一個 });
看起來像是關(guān)閉了那個監(jiān)聽器,直到我用正確的格式編輯了問題.現(xiàn)在你可以知道還需要另一個 });
.
As mentioned in the comments, add });
to the very end of your code. This should close off the client.on
event listener. The final });
in your code looked like it closed off that listener until I edited the question with proper formatting. Now you can tell there is another });
needed.
感謝@SterlingArcher,我回答了 b/c 我不想再將其視為未回答的問題.
Credit goes to @SterlingArcher, I answered b/c I want to stop looking at this as an unanswered question.
這篇關(guān)于得到“輸入意外結(jié)束";在 Javascript 中制作 Discord Bot的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!