![](/img/trans.png)
[英]I have to make a webpage that can run some simple JavaScript, but I don't think my script is running
[英]I made this and my bot loops the “else” function. I'm confused cuz I don't think I have any intentions to make a looping function
我制作了一個機器人來管理 discord 角色,這是我的代碼
bot.on('message', (message) => {
const parts = message.content.split(' ');
if (parts[0] == 'Platform' || 'platform') {
if (parts[1] == 'iOS') {
message.channel.send(`thx, ${message.author}`)
message.member.roles.add(iOS);
}
else {
message.channel.send(`nooo`)
}
}
}
為什么我的 else 命令不斷重復? 我該怎么做才能阻止它?
您的代碼應為:
if (parts[0] == 'Platform' || parts[0] == 'platform') {
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.