Trying to make a command that flips the characters in a string from user input after the command, so “hello world!” turns into “!dlrow olleh”. I keep getting the “Right-hand side of ‘instanceof’ is not an object” response from nightbot can anyone help with my code and tell me what’s wrong?
!addcom !reverse $(eval const n = ‘$(query)’; const r = n.split(); const v = r.reverse(); const f = v.join(); ? f;)
If the command you’re using is directly copy-pasted, you have to change the quotes you’re using - This should work: '$(query)'
You’ll also have to add an empty string when splitting, or else it won’t actually split - This should work: n.split('')
EDIT: Seems you’ll also have to remove that ? at the end, as well as putting '' inside the v.join(''), or else it defaults to comma.
Full command should look something like: !commands add !rev $(eval const n = '$(query)'; const r = n.split(''); const v = r.reverse(); const f = v.join(''); f;)