简体   繁体   中英

How can I make sure that my twitch bot can only take commands from certain users with NODEJS and the TMI API?

I am trying to make a twitch bot that uses a command that only the channel owner can use. How can I identify a unique user. Basically, how can I tell the program to only allow a certain user to use a certain command?

I fixed my issue using the following: ${user['display-name']} then applied this to a variable and used an if statement. Like this

    var chanName = '${user['display-name']}`;
    if (chanName === 'usernameperson`){
       stuff;
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM