NightDev Community Forums

Want night bot to post random jokes every 15mins

want night bot to post random jokes every 15mins from a joke file how can we do this please take in mine i am useless many thanks in advance

Hey @smartymarty001!

  1. Go to Pastebin and fill a paste with your jokes, it’s not an issue if the jokes are all one after the other, but you can also enter a joke per line, what matters is that between each joke you add an hashtag (#) and that you don’t use an hashtag anywhere in your jokes. Make sure each joke doesn’t go above 400 characters.
    The paste should look like this: Joke_1 # Joke_2 # Joke_3 # ... # Joke_x

  2. Save the paste and make sure the expiration date is set to “never”. I recommend you to create a free account so you can come back to edit the paste later if you want to add or remove jokes.

  3. Copy the URL of the paste, it should look like this https://pastebin.com/xxxxxxxx and add raw/ before the letters identifying your paste, like this https://pastebin.com/raw/xxxxxxxx

  4. Replace PASTE_URL with the paste URL in the following code:
    $(eval a=`$(urlfetch json PASTE_URL)`.split(`#`);a[Math.floor(Math.random()*a.length)])

  5. Go on your Nightbot Dashboard timers page, add a timer, and paste the code in the message field, set the interval to 15min, give it a name, click submit and there you go!

Hope this is clear enough.

You can also format the joke like: ‘joke1’, ‘joke2’, and so on. also instead of spaces, for organization, you can make it other lines

Hey @David_Bendee!

Yes, you could, but it wouldn’t work with how I wrote the code. You’d have to replace .split(`#`) with .split(`,`). I chose not to use commas as separator to be able to use them inside the jokes.
And I mentioned about the possibility to put one joke per line, I just didn’t illustrate it here to save space.

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