I need help to create this command

Hello, first i’m sorry if there are errors in my writing, I do not have a very good English. I am trying to create a command called ‘’!report’’. The idea of this command is only to be fun for users. The command is supposed to work in this way:

User: !report @user2 use the pacman (:v)

and bot reply…

Nighbot: The user @user2 has been reported for ‘‘use the pacman (:v)’’.

My problem is that I can’t use argument variables $(1-9), as the idea is that the user’s ‘‘reason’’ is unlimited words. Nor can I use $(query) as this repeats exactly what the user says and i could not customize the bot response. Is there a way to do this with a customapi or something?

The following javascript code puts the arguments in an array “args”. It can also be used to have a custom seperator (if you don’t want to split at each space but at each colon for instance, juste replace ` ` with `:` in split).

$(eval
  args=decodeURIComponent(`$(querystring)`).split(` `);
  // then do your stuff
)

Hey @lunaafps!

Following on the answer of @Nightingale38, here’s how you’d make your command:

$(eval q=decodeURIComponent(`$(querystring)`).split(` `); u=q.shift().replace(`@`,``); `The user ${u} has been reported for "${q.join(` `)}."`)

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.