Hi. Basically i want to an !elo command with random responses, whenever anyone enters their username afterwards. If however they type in my username, i want a specific response to show up. this works fine with the following code.
$(eval
const responses =
['Lvl: 1 Elo: 134',
'Lvl: 1 Elo: 134',
'Lvl: 2 Elo: 853',
'Lvl: 4 Elo: 1212',
'Lvl: 3 Elo: 998',
'Lvl: 3 Elo: 1043',
'Lvl: 1 Elo: 403',
'Lvl: 1 Elo: 754',
'Lvl: 2 Elo: 924',
'Lvl: 3 Elo: 952',
'Lvl: 1 Elo: 69', ];
if ( "$query" == "_de4d")
{"Lvl: 11 Elo: 9001";}
else responses[Math.floor(Math.random() * responses.length)];
)
However, i want it to show the same response if the query is empty. I thought i could realise it this way:
$(eval
const responses =
['Lvl: 1 Elo: 134',
'Lvl: 1 Elo: 134',
'Lvl: 2 Elo: 853',
'Lvl: 4 Elo: 1212',
'Lvl: 3 Elo: 998',
'Lvl: 3 Elo: 1043',
'Lvl: 1 Elo: 403',
'Lvl: 1 Elo: 754',
'Lvl: 2 Elo: 924',
'Lvl: 3 Elo: 952',
'Lvl: 1 Elo: 69', ];
if ( "$query" == "_de4d")
{"Lvl: 11 Elo: 9001";}
else if ( "$query" = null )
{"Lvl: 11 Elo: 9001";}
else responses[Math.floor(Math.random() * responses.length)];
)
in chat i get the response: Invalid left-hand side in assignment. not quite sure what im doing wrong. if anyone has an idea, i would greatly appreciate it.
greetings,
de4d