Création de commande

Comment faire une commande exemple ( ! distribution de câlin ) et que nightbot répond ( tu as autant … de câlin ) ? Merci

Hey @mrspike59_officiel!

J’imagine que tu veux un nombre aléatoire de câlins entre 1 et x, dans ce cas, copie/colle ça dans ton chat, c’est une commande qui distribue entre 1 et 100 câlins à chaque fois qu’elle est appelée!

!addcom !calins -cd=5 $(eval `Tu as ${Math.floor(Math.random()*100)+1} câlins!`)

Si tu souhaites changer le nombre maximum de câlins remplace 100 par le nombre de ton choix.
Si tu souhaites changer l’interval du nombre de câlins remplace min et max dans la commande suivante par les nombres de ton choix!

!addcom !calins -cd=5 $(eval `Tu as ${Math.floor(Math.random()*(max-min+1))+min} câlins!`)

Exemple: de 10 à 50 câlins

!addcom !calins -cd=5 $(eval `Tu as ${Math.floor(Math.random()*(50-10+1))+10} câlins!`)

ou…

!addcom !calins -cd=5 $(eval `Tu as ${Math.floor(Math.random()*(41))+10} câlins!`)

J’espère que ça t’as aidé!


Translation of the request

How to make a commande that distributes a random number of hugs?

For a random number of hugs between 1 and 100:

!addcom !hugs -cd=5 $(eval `You get ${Math.floor(Math.random()*100)+1} hugs!`)

If you wish to change the max amount of hugs one can get, replace 100 by the max number of your choice.

For a random number of hugs between a max and a min number:

!addcom !hugs -cd=5 $(eval `You get ${Math.floor(Math.random()*(max-min+1))+min} hugs!`)

Example: from 10 to 50 hugs

!addcom !hugs -cd=5 $(eval `You get ${Math.floor(Math.random()*(50-10+1))+10} hugs!`)

or…

!addcom !hugs -cd=5 $(eval `You get ${Math.floor(Math.random()*(41))+10} hugs!`)

Hope this helps!

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