I’m trying to make a command that causes Nightbot to give a random response to any question from a big list of responses on Pastebin.
Here’s my code, which I got from this post.
!commands add !ask -cd=5 $(eval responses = $(urlfetch json https://pastebin.com/raw/WURvJ4MR).split(";"); responses[Math.floor(Math.random() * responses.length)])
This command works perfectly fine, but there are two additional things I want to do:
- I want Nightbot to ping the user who asked the question at the beginning of the message. (Example: “@Dimentive Without a doubt.”)
- I want Nightbot to say a specific message if the user does not input a variable. (So, if someone just uses
!ask, without a question, I want the bot to say
Please ask a question: !ask *question*
Any help is greatly appreciated!