Alright, Ive finally completed the bot (version 1 atleast).
Ive added 3 unique commands to the base tutorial bot. /langusteen-fact, /langusteen-mood, and /langusteen-pic. The names are pretty self explanatory, the first brings up a random crustacean fact, the second acts as a sort of mood indicator for what the bot is feeling, and since it ISSS based on a crustacean, i made the moods sound like a real langoustine trying to talk to youuu!!
I learned how to create and import arrays from other files into my project code, since thats what i used to create those two features.
The last command, brings up a random crustacean image. I used the pexels API for this but quickly encountered a problem, it kept spamming the same few images. Thats when i thought, what if i designed an array of search terms just like the first two commands, that way, the images are much more diverse, and it worked. Although the exact search term had to be modified multiple times before i found something that would actually give me nice images.
There was this other issue i ran into where the command only gave me the links to the images instead of the actual image. After a bit of digging, I discovered how to use an image block, which ensures that the image actually gets rendered in slack instead of just spitting out a link.
I also edited the help function to appropriately list the available commands on the bot.
I tested the commands in order in the image below. The pic command is definately my favourite. Just looking at all the cool pics is pretty fun, and knowing i made it makes it feel even better :D.
Comments 0
No comments yet. Be the first!
Sign in to join the conversation.