NightDev Community Forums

[CustomAPI] Quote system


#81

Yeah no spaces. Exact string that we had before entered into the timer.


#82

What did the query look like?


#83

$(urlfetch http://twitch.center/customapi/quote?token=8df3f178&data=$(querystring)&no_id=1)


#84

Yeah, you can’t use variables in timers. Here, $(querystring) get’s replaced what what the person puts after the command in chat. But in timers there’s nothing. So basically just remove that.

$(urlfetch http://twitch.center/customapi/quote?token=8df3f178&data=&no_id=1)


#85

Interesting. I removed that before and still got the same thing. :frowning: But I’m trying it again


#86

Yeah it worked. Damn. I totally tried taking that out and it didn’t seem to work. Thanks again Ehsankia!


#87

It’s working great for me, I’ve added it to 2 of the Channels I’m a Nightbot Editor for, I’m Just wondering if there’s a way to just have month/year without a Day for the time stamps? I don’t see it in the list of common variables

Edit: I Just realised it’s a normal Nightbot $(time) command, DOY. I found it… Still This is a great API, Keep Up the good work :smiley:


#88

Here’s Yep you can put any valid time format string. More examples here:
http://momentjs.com/docs/#/displaying/


#89

Getting “no matching quote found” again. :frowning:

This time it is on my other list: http://twitch.center/customapi/quote/list?token=d49fff23

Timer Query: $(urlfetch http://twitch.center/customapi/quote?token=d49fff23&data=&no_id=1)


#90

This seems to be working fine with the Timer Query you posted.


#91

Figured this out. I had an alias defined in the configuration of the timer. Case solved.


#92

When adding a quote to the bot today, I’m getting “Remote Server Returned Code 500”. But I can retrieve and delete quotes, just not add this one for some reason. !addquote Either that, or Duncy hasn’t had a chance to harden for a very very long time.

Any idea what might be causing this? Otherwise I’m really happy with this API! Thank you for developing it :smiley:


#93

Interesting, it has to do with the game you’re playing (Pokemon) and the fact that your quote automatically includes the game name. More specific, it’s the “é” in the name. But the bug isn’t with you, it seems like nightbot $(game) is sending the game name with the wrong encoding. It seems to be latin-1 instead of utf-8?

@night can you look into that?


#94

Aha! That makes sense for sure. Thanks for looking into it :slight_smile: Is there a way I can add it manually? I like having the game and time added to the quotes so that we have a referencepoint.


#95

@ehsankia do you have a quick repro for the issue? encoding is already utf8


#96

The way I have it is:

$(urlfetch http://example.com/?data=$(twitch $(channel) "{{game}}"))

And my channel game is set to any Pokemon game with é in it.

And my server is receiving data=Pok%E9mon

\xe9 is a valid latin-1 character, not utf-8

Should I be wrapping the $(twitch) variable in some query variable?


#97

Yes, you should be wrapping it in $(querystring)… so $(urlfetch http://example.com/?data=$(querystring $(twitch $(channel) "{{game}}"))) should work I think


#98

Works, though using $(channel) was giving me “unknown twitch channel”. Is there a nest limit for variable? Because this is 3 layers deep (twitch inside querystring inside fetchurl).

I hardcoded my channel name though and can confirm the unicode bug goes away.

so try that @hopsqueak, surround the $(twitch) variable with $(querystring) and you may need to replace $(channel) with your real channel name.


#99

I’m somewhat lost at this whole thing, so could you help me modify the command I’ve got so that I can adjust it to the two version of nightbot I maintain?

This is my !addquote command:
$(urlfetch http://twitch.center/customapi/addquote?token=redacted&data=$(querystring) [$(time Australia/Lindeman “L”)] [$(twitch $(channel) “{{game}}”)])


#100

$(urlfetch http://twitch.center/customapi/addquote?token=redacted&data=$(querystring) [$(time Australia/Lindeman "L")] [$(querystring $(twitch $(channel) "{{game}}"))])

if that fails replace $(channel) with your actual username.