Grabbing Quotes from Pastebin!

I was looking for simple quote system pulled out from, for an example using this link( Doing !quote #2, pulling out the “I’m now on the mode I’m at” ~ Stan [16.3.2017], [Csgo] to the chat and also if someone types !quote alone can it generate random quotes out of the list!

Thank you.

Looking at this paste, you would have to write up a script with a complex regular expression (search pattern) that tells the bot where each quote starts and ends.

You can avoid that by writing the paste such that the quotes are stored in an array. Look at this example paste used for a trivia command:

Notice the important aspects of the array:

  1. The paste starts and ends with square brackets.
  2. The quotes are separated by commas.
  3. Each quote is bounded by backticks.

Once you’ve created a paste that reflects these aspects, you can copy and paste the following command setup:

!addcom -cd=5 !quote $(eval a=$(urlfetch json;a[parseInt(decodeURIComponent(`$(querystring)`))-1]||a[Math.floor(Math.random()*a.length)])

Replace with your raw paste link.

This command will output the quote at the specified index if the user provides a number, and will output a random quote if there is no input or the input is a number that doesn’t make sense (ie. the number is greater than the array length or is less than 1).

1 Like

Thank you @RokettoJanpu for the pointers

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