Closed HeadShootPxG closed 3 years ago
You want to use str.includes
(MDN) not str.indexOf
. indexOf
will return 0
through str.length - 1
if the test value is in the string and -1
if it's not. includes
will return true or false.
The tmi.js issues are not for programming questions. Please use MDN, StackOverflow, the "Twitch API" community Discord (#general-javascript
), or the official TwitchDev Discord (#javascript-and-node
) for general JavaScript support.
Hello,
I would like to respond to a specific person and only when he writes a sentence that I have defined.
I think I did it wrong
if someone can tell me how to proceed
if (displayName == 'myname' && message.indexOf("Im going to win")) { client.action(target,"GG !"); }
unfortunately as soon as I write with the nickname defined it sends GG directly without checking the sentence