[CustomAPI] Quote system

Hey,

i think the delquote/addquote should be:

But i tried to recover it myself, and it didn’t help.

I only had 12-14 Quotes on my account. That’s all. Maybe it is easy to find them.

I guess you’re not gonna use this anymore so it doesn’t matter as much, but in the future never post your private key publicly. I backed up your quotes but someone could’ve gone and deleted them all if they were faster than me. In the future PM it directly instead.

Here’s the quote that were until that token:
https://pastebin.com/yyUZkteW

If these aren’t it, then they’re probably lost.

Oh and make sure to change your add/del quote commands after this.

Thank you very much.

That are exactly the quotes. I will change my commands. Thank you very much for your kind help!

I appreciate it very much

how did you get your foolowers

can you give me the list url of token=2? i want complete this command
the code have 223 word but commands only can enter maximum 200 words
the solve sulution is decrease the length of value “r”
and please open the $(touser) write permission,let regular and moderator also can write
2017-08-14_174704

This is a check in syetem code
$(touser)$(eval var p="$(touser)",q="$(urlfetch https://goo.gl/WFDDfh)",r="$(urlfetch http://twitch.center/customapi/addquote?token=2c918790b386a896&data=$(touser))"; if(p==q) {(“今天已簽到,請明天再來!”); }else{(“已簽到,獲得50個932幣”); })

@ehsankia – I was wondering… Is there any way I can make my !addquote command not spit out the message “Successfully added entry #”? I wanted to have Nightbot say a custom message when the entry is added, and for the most part I’ve managed so far, but along with the custom message Nightbot also responds with the successful bit…

Thanks a bunch in advance!

That’s a great idea! I also want do that

@932_frc: In the mean time you can do what I did and use the str.slice() method to cut that message out of the response. But it’d be nice to have an option and not have to add extra code into the command :stuck_out_tongue:

Hi, I tried to set quotes up on a timer using $(urlfetch http://twitch.center/customapi/quote?token=TOKEN&data=) as the timer message, but nightbot is only pulling the last quote on my list every time. I also have the alias set to !quote.

I have a quick question. Would it be possible to get two quote commands running under different names? Because I would like to have a quote command for quotes… Big surprise there haha. But I would like to have a second one for drink recipes. So If someone would use !drink negroni, the recipe for a negroni would show up in chat. Is this possible to do?

@oldshattergeek, yes, manually install another set of quote/addquote/delquote commands with a new token, but with a different command name, such as !recipe, !addrecipe, !delrecipe. Just press the manual install and it generates a new set of keys.

@bb_kait, Sorry, I’m not sure. If you private message me the private quote, I can look up the exact command that’s being send to my server.

I have two questions (and requests for functionality, if there’s not already a solution):

  1. Is there a way we can make the command not return anything unless the query matches a word in one of the quotes? I’ve used it to simulate a two-word command (if someone says “I’m cool”, for example, it would respond to them with “I’m cool too”), but whenever anyone starts a sentence with “I’m”, Nightbot chimes just chimes in anyway because it only has the one quote to work with.

  2. Is there a way to name/tag quotes, so that they are only returned in response to a specific word instead of being returned if any word in the quote is matched? I’m curious about this both for the aforementioned situation and just in general, as I’d be more likely to use the quote system as an actual quote system (with another set of keys, of course) if this were possible as opposed to having to request it by number or a phrase contained within the quote.

Thanks for reading and responding.

1 Like

Just out of curiosity, did you ever figure out a solution to the issue @bb_kait had. I have been trying to do the same thing and have been getting the same result. I have tried just using the command to retrieve a quote, as well as I have tried to use a random number command and then alias to the regular quote command and it also results in Nightbot just pulling the last quote.

Hello :slight_smile:
Is there anyway i can only allow a user to only use the command once unless i clear the whole list with clear=1?

Also is there a way to delete several quotes at once? for instance !delquote 20-40?

Kind regards

Go to https://twitch.center/customapi/quote/generate. You will see three lines. After token= on the first line, you will see your first token. After token= on the second and third lines, you will see your second token. Use these to replace FIRSTTOKEN and SECONDTOKEN before you add the following commands.

!addquote (alias to !addquoteadder)

$(eval queueString = `$(urlfetch http://twitch.center/customapi/quote/list?token=FIRSTTOKEN)`; userExists = false; regex = /\d+\. \["(.*?)",".*?"\]/g; while ((match = regex.exec(queueString)) !== null){if (decodeURIComponent(match[1]) === `$(user)`){userExists = true}} if (userExists && `$(userlevel)` !== "moderator" && `$(userlevel)` !== "owner") {"?"} else {"?token=SECONDTOKEN&data=" + encodeURIComponent(JSON.stringify([encodeURIComponent(`$(user)`), encodeURIComponent(`$(query)`)]))})

!addquoteadder

$(eval `$(urlfetch http://twitch.center/customapi/addquote$(query))`.includes("Successfully added entry") ? `Your quote was added @$(user)` : (`$(query)` === "?" ? `You already have a quote @$(user)`: `Please use !addquote @$(user)`))

!viewquotes

$(eval queueString = `$(urlfetch http://twitch.center/customapi/quote/list?token=FIRSTTOKEN)`; message = ""; regex = /\d+\. \["(.*?)","(.*?)"\]/g; while ((match = regex.exec(queueString)) !== null){message += decodeURIComponent(match[1]) + ": " + decodeURIComponent(match[2]) + ", "} message ? message.substr(0, message.length - 2) : "There are no quotes added")

Each of the quotes are encoded to include the username of the person who added it. So you’ll have to parse each quote before it can be properly displayed. If you want my help with this let me know.

I don’t think it’s currently possible to delete several quotes at once, because Nightbot is unable to loop through $(urlfetch)'s.

Sweet i will try to install that!

Is it OK that i basicly made an 8Ball command for nightbot using the Quote system?

Command:
!addcom !8ball $(user) has asked 8ball the Question: ◄$(query)?► 8ball Awnser is: ◄$(urlfetch http://twitch.center/customapi/quote?token=833fab7d&no_id=1)!►

(anybody can basicly add this code without any problems)

Would you improve it in anyway?

For instance. if there is no $(query) given it would reply with You got to ask a question first or something.

It’s only necessary to use the quote system for an 8ball command if you have too many responses to fit into the command itself. Are you sure that you do?

!8ball command that doesn’t use urlfetch:

$(eval r=["It is certain","It is decidedly so","Without a doubt","Yes definitely","You may rely on it","As I see it, yes","Most likely","Outlook good","Yes","Signs point to yes","Reply hazy, try again","Ask again later","Better not tell you now","Cannot predict now","Concentrate and ask again","Don't count on it","My reply is no","My sources say no","Outlook not so good","Very doubtful"];(`$(query)`?r[Math.floor(Math.random()*r.length)]:"Ask a question")+` @$(user)`)

1 Like

I didnt even know that was a possibility…

Now i gotta ask. Is there a way to make a Voting system based on your quoting system?

I am seeing quite some endless possibilitys as long as it fits into nightbots command line.

That is possible. I have to go now but I can write that command later if you want. But are you aware of the existing !poll command?
!poll - Nightbot Docs Let me know if that fits your needs.

Sadly the !poll command does not alow deleting things that have been done already or adding new things. i would have to redo the poll command everytime.

Edit: i also would like voting to be done in the chat with !vote 1 or 2 or 3