[英]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
I made a bot with purpose to manage discord roles and here's my code briefly我制作了一个机器人来管理 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`)
}
}
}
Why my else command keeps going over and over?为什么我的 else 命令不断重复? How am I supposed to do in order to stop it?
我该怎么做才能阻止它?
Your code should read:您的代码应为:
if (parts[0] == 'Platform' || parts[0] == 'platform') {
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.