Custom commands !arena and !match (variable question)

Hello everyone.

I am trying to create two custom commands, !arena and !match, for our SSBU and SSBM streams. If done right these two commands should work for any fighting game or game with a best 2 out of 3 / 3 out of 5 setup.

We want !arena to output the current Lobby ID and password when any user calls !arena.

We want !match to display the current match set score and the bracket position.

We want to be able to have moderators set the current !arena info and the current !match info between games.

Example 1:
ttvuser: !arena
nightbot output: The current lobby ID is () and the PW is ().

Example 2:
ttvuser: !match
nightbot output: The current match is (bracket position) and the score is (x-x).

I’ve got experience using code in other applications but I’m having a tough time understanding how I can allow our moderators to change the variables. How can I write the code so that our moderators can set things like the lobby ID and PW for !arena, and how can I write the code so that our moderators can set the (bracket position) and score for !match, while allowing regular users to use the commands as described above?

Thanks in advance!

@cozycovegaming

I have set up 4 commands below, !arena which shows the arena info, !match which shows the match info, !editarena which edits the arena info, and !editmatch which edits the match info. Copy and paste each setup into chat one by one to add the commands.

!addcom -cd=5 !arena Filler text.

!addcom -cd=5 !match Filler text.

!addcom !editarena -a=!editcom !arena $(eval a=decodeURIComponent(`$(querystring)`).split(` `);a.length==2?`The current lobby ID is ${a[0]} and the PW is ${a[1]}`:` `)

!addcom !editmatch -a=!editcom !match $(eval a=decodeURIComponent(`$(querystring)`).split(` `);a.length==3?`The current match is ${a[0]} and the score is ${a[1]}-${a[2]}`:` `)

Command usages:

!arena
!match
!editarena [lobby ID] [password]
!editmatch [bracket position] [player 1's score] [player 2's score]

Note that !editarena requires 2 arguments in the user input in order to edit !arena. If the user input has less than or more than 2 arguments, Nightbot will still output a message indicating that it has edited !arena, but the command won’t actually be changed. The same goes for !editmatch which requires 3 arguments.

I am going to copy paste these in and try them now.

Thank you so much for a response Roketto, I appreciate it! I’ll let you know if I run into any issues with it

arenamatchsyntax

Works like a charm. Thank you sir.

All of the accounts I have to log in and use are moderators - will non-moderators be able to access the editarena / editmatch commands that were listed? Not a huge deal if they can, I’ll just make sure to enter commands outside of chat

!editarena and !editmatch pass inputs to !editcom, which is mod-only by default. Non-mods cannot use them.

1 Like

Thank you! You’re the man!

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