简体   繁体   English

我做了这个,我的机器人循环了“else”function。 我很困惑,因为我认为我没有任何意图制作循环 function

[英]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.

相关问题 我必须制作一个可以运行一些简单JavaScript的网页,但是我认为我的脚本没有运行 - I have to make a webpage that can run some simple JavaScript, but I don't think my script is running 我不了解此功能。 [Codecademy联系人列表练习] - I don't understand this function. [Codecademy Contact List excercise] 我正在尝试为我的机器人在 discord.js 中创建一个自动角色 function 但它不起作用 - I'm trying to make an autorole function in discord.js for my bot but it doesn't work 我已经用JavaScript进行了幻灯片放映,但是我不知道如何使照片变得发呆 - I have made a slide show in javascript but I don't know how to make my pics faze 我正在尝试使用我在 this.then() function 中获得的返回值。我不知道如何修复它 - I am trying to use the return value that I get in this .then() function. I don't know how to fix it 我对我的训练营模块中概述的 function 感到困惑 - I'm confused about a function outlined in a module of my bootcamp 我不认为我的jquery函数正确 - My jquery function I dont think is correct 当我在Javascript代码中添加特定行时,它会删除HTML函数具有的onclick函数。 - When I add a certain line to my Javascript code it removes the onclick function I have for my HTML function. jQuery具有显示功能。 当我尝试在他们的代码中找到它时,我找不到。 关于javascript我不了解什么? - jquery has a show function. When I try to find it in their code, I cannot. What don't I understand about javascript? 我的 function 有问题,我不想用现有坐标创建节点 - I have a problem about my function, I don't want to create a node with existing coordinates
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM