I’m sorry if this has been asked before, I’m sure it has. I’m new to NightBot, and I wanted to make some generated responses to a command. For instance, I do a lot of Pokemon Content on my channel. So I’d like to create a ‘Who’s that Pokemon command’, where if the viewer types !whosthatpokemon, Nightbot will choose from a series of other commands that will be descriptions of the pokemon.
For example !whosthatpokemon > !pikachu “This Pokemon can generate powerful electricity, within their cheek sacs that are extra soft and super stretchy”, but then if they type !whosthatpokemon again, it will choose a different description.
I’m not sure how to go about doing this or if its even possible.
Nightbot can only call one alias as far as I know, in that case this is not possible at the moment. You can instead do !whosthatpokemon random responses. There’s a lot of pokemons so it would be hard aswell to call alias, you would add tons of specific commands for them.
If you want to try the other method, idk if you already know it:
Make a pastebin of the pokemons and their abilities/descriptions and add a ; after each one. Example:
Pikachu, example example example;
Charmander, example example example;
Squirtle, example example example;
and so on.
Add this command and replace the YOURPASTEBINHERE with the /RAW/ version of the pastebin you created:
What With_Vince suggested is the right direction. But I would like to expand a little bit on it since it seems you’re looking for the ability to do !whosthatpokemon pokemon as well as a random output if no query is specified. So here we go!
Create an account on Pastebin to be able to edit your paste in the future. Make sure the paste expiration date is set to never and I’d recommend setting the paste as unlisted.
In the paste type your Pokemon’s descriptions like the following example: put a ; (semi-colon) after each Pokemon name and at the end of every description except for the last one.
Pikachu; this Pokemon can generate powerful electricity, within their cheek sacs that are extra soft and super stretchy.;
AnotherPokemon; sorry, I don't know anything about Pokemon...;
LastPokemon; last description.
Then for the command it looks like this:
!addcom !whosthatpokemon $(eval p=`$(urlfetch json https://pastebin.com/raw/XXXXXXXX)`.split(`;`);q=decodeURIComponent(`$(querystring)`).toLowerCase();t=[];for(i=0;i<p.length;i++){t[i]=p[i].toLowerCase();}if(q){t.includes(q)?`${p[t.indexOf(q)]}:${p[t.indexOf(q)+1]}`:`Pokemon not recognized.`;}else{r=Math.floor(Math.random()*(p.length/2))*2;`${p[r]}:${p[r+1]}`;})
Sorry to keep bothering with this, I put in the command and when I tried it. It worked once, but now when I try it, nightbot comes back with undefined:undefinied. I’m guessing I’ve put in some text wrong somewhere, for it to come up with this?
Edit: I tried it again and it seems to be working occasionally but not all the time.