NightDev Community Forums

!fight command with different tactics for Youtube

Hello guys, i really need this command !fight , where it picks random winner between two users.
If anyone is reading my message, please help me out.
Examples :-
!fight Pat
Nightbot - ​samshera claims a flawless victory!
OR
Nightbot - Pat fell in a hole whilst escaping samshera!
OR
Nightbot - ​samshera wanted a rap battle… and lost!

Please help me in this.
Regards,
samshera

Hey @samshera!

Here’s how you can do this: first head over to Pastebin and create an account so you can go back to it later and edit your pastes.

Then create your paste like this:

sentence_1_blablabla|
sentence_2_blablabla|
...
sentence_n_blablabla

Fill the paste with the answers you want Nightbot to give you, and end each of them with a | (vertical bar). If you want to have $(user) (the one who called the command) at a specific place in the sentence, write ${u} instead of $(user), same thing for the target of the command, write ${t} instead of $(touser).

Make sure the paste is set to never expire and unlisted, then save it.

And finally, here’s the command:

!addcom !fight $(eval u=`$(user)`; t=`$(touser)`;r=`$(urlfetch json https://www.pastebin.com/raw/XXXXXXXX)`.split(`|`); r[Math.floor(Math.random()*r.length)];)

Replace XXXXXXXX with your paste ID.

1 Like

Hey there, I really appreciated your time… But it failed… it said unexpected identifier

could you please help me in this matter?

I don’t have any knowledge in it…

Remove the sentence_X_ part in your paste.
And the reason why it failed is my fault, it was late at night when I wrote the command and I forgot a ` (backstick)… Sorry about that.
If you copy the full text in the box by replacing XXXXXXXX into your chat it will create a !fight command, you use !addcom to create a command…

1 Like

I know it might sound irritating to you…
sorry about that.
Where should i add ` (backstick) …
This is my first time here… so i had zero knowledge in it.

No worries, it’s alright, we’re here to help, that way you learn as well at the same time.
I edited the command I posted to add the ` (backstick), but it would go after $(user)

1 Like

A BIGGGGGG THANK YOU EMILY… Hurray it worked… it worked…Thank you so much dear… You just made me smile. People like you, i wish i had friend like you… people don’t easily help, but you did without getting irritating… You are awesomeeeeee !!!
I wish you tonnes of happiness and positive vibes. God Bless You Emily…

1 Like