Nightbot: Invalid or unexpected token

Asked Jul 28, 2020·6 replies·Last activity 6 years ago·Open in Discord ↗
Archived from the original community forum
Things may have changed since it was written. Still stuck? Ask the community on Discord.

When ever I add a new command that pops up older commands work fine. Can’t seem to find our why

6 replies

Can you please explain more as to what is going on?
Are you getting the error message when you use the older or newer command?
What are you trying to do with the new command?
Are you using the $(eval) variable?

This command
!commands add trigger $(eval var a = "$(query)";

if (a === "phrase") {

("YOUR_MESSAGE");

} else {

(" ");

})

Try this:

!addcom trigger $(eval var a=`$(query)`;a==`phrase`?`YOUR_MESSAGE`:` `)

Please note phrase is case sensitive and will only activate if typed exactly how it is In the command this means no capitals unless it’s was Phrase for instance.

That seemed to work many thanks!

Quirky Fox said:
Please note phrase is case sensitive and will only activate if typed exactly how it is In the command this means no capitals unless it’s was Phrase for instance.

That's where you can use handy javascript functions like toLowerCase:

js
a.toLowerCase() == `phrase`

Didn't find your answer? The community is on Discord.

Ask on Discord