Arbitrary Quote Command

I have a quote command to every 20min give me a quote about socials, discord etc, but the quotes are always random.

Is there any command similar to quote where you can quote arbitrary from a list?

Thanks for reading, cheers!

I’m assuming you using @ehsankia’s quote api and if you call the number of the quote you want it should choose that quote.

Not only that, but if you pass it a word, it’ll to a search for that word (If I remember how I coded it!)

So if you have let’s say instagram, twitter, etc as quotes, you can just do !quote instagram and it’ll hopefully find the right quote.

1 Like

I use that quote api but I have a timer to send a message evey twenty minutes but its always random. If I put !quote 1 as a command every 20min it will always send the same message. How do I do to send !quote 1 first, than !quote 2, etc…?

I know but I don’t always want the same message. I want message 1, then message 2, then message 3.

With the quote command I have message 2 then message 3, than 2 again, and then finally 1.

I don’t want random messages…

If !qoute is the alias you could eval a count like this:

$(eval a=Math.floor($(count)%3);if(a==0){a=3}else{a=a};a)

And just put that in the message field.
This will just cycle through 1-3.

1 Like

OMG thank you so much, I search so much for a code like this and tried myself and never could do it!

Thank you!

If I had quotes and start having 4 or 5 quotes, do I change bith 3’s in this code to 4 or 5? Or only one of them?

Thanks so much again for taking the time!

Yes if you get more than 3 just change both the threes to 4’s or 5’s.

1 Like

You’re the best, thank you!

I’m sorry man, I’m having a problem. That formula does work as a command, but in a timer at every 20min, the Nightbot is always quoting the quote number 3, why doesn’t it change every 20 minutes?

I’m gonna have to do some testing I’ll get back to you.

Ok, so I didn’t know this but apparently the $(count) variable is not allowed in timers. But don’t worry there is a fix I can do just use this in place of the previous one:

$(eval a="$(time UTC "h:mm:ss")".split(":");b=parseInt(a[1]);if(b<20){c=1}else if(b<40&&b>19){c=2}else{c=3};c)

This is just a simple work around using the timer instead of $(count) let me know if there are any issues.
This will also only work for 3 quotes as of now though it is possible to add more it will just be more complicated.

I’ll try my friend and I’ll give the feedback later. Thank you very much for taking the time!

For now I only need 3 quotes but I don’t know if eventually I need to add some. For now I’m just grateful man :pray: thank you!

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