Hello, I have a small amount of experience creating commands but am having some trouble trying to figure out the proper syntax for what I need. I’d like to be able to fetch info about specific Pokémon with a !dex command, I’ve decided to take on the task of creating a pastebin to draw info from so that it fits the character limit for twitch while also being informative about each Pokémon. I’m using JSON format with the entries as such:
{“Pokémon1”:“Info about Pokémon 1”,
“Pokémon2”:“Info about Pokémon 2”,
“Pokémon3”:“Info about Pokémon 3”
}
What would be the best way for me to target each specific entry, for example, if I want to know about Pokémon 1, I can do !dex Pokémon1 and retrieve the appropriate information?
I created a command of that style and added a message in case they use the empty command without text and another error message in case they misspell a number
$(eval const data = $(urlfetch json https://pastebin.com/raw/******); const query = '$(query)'.toLowerCase(); query === '' ? "Use !dex followed by a number between 001 (always 3 digits) and 1025 to search the entire pokedex." : data[query] || "No Pokémon with that number were found. Remember that between 001 and 099 you need to write 3 digits.
";)
Thank you, that’s awesome! I love the idea of a helpful error message ~ I tried it briefly and got an error but I may have missed some syntax, thank you for your help!