Change default response of custom api

Hi, this is xloss,

I’ve successfully installed CUSTOM API
by using this link : https://twitch.center/customapi/quote/nightbot

When I send “!addquote”
Nightbot’s Responce : Successfully added entry #1

How Can I? edit this responce

also , If I want to delete all entries, except last 15 updated entries,

i use this command to delete single entry : $(urlfetch https://twitch.center/customapi/delquote?token=aa23711b715e9263&data=1)

Thanks

@xloss

You can edit whatever Nightbot displays in chat by putting the $(urlfetch) inside an $(eval) like so:

$(eval a=`$(urlfetch https://twitch.center/customapi/addquote?token=PRIVATE_TOKEN&data=...)`;`CUSTOM RESPONSE HERE`)

Replace PRIVATE_TOKEN with your private token (16 characters long) and CUSTOM RESPONSE HERE with your desired response.


You can use this to delete all entries at once:

$(urlfetch https://twitch.center/customapi/delquote?token=PRIVATE_TOKEN&clear=1)

Replace PRIVATE_TOKEN with your private token (16 charactes long). Note that this function clears all entries and can’t be modified to only delete certain entries.

1 Like

Is this a custom API you are using in the command? If so, what is the URL?

1 Like

I needed the URL so I could take a look at how the response is set up as a JSON object. This should only show the subscriber count:

$(eval a=$(urlfetch json https://www.googleapis.com...);try{a.items[0].statistics.subscriberCount;}catch(e){`Error!`;})

This is within the YouTube character limit:

$(eval a=$(urlfetch json https://www.googleapis.com...);a.items[0].statistics.subscriberCount)
1 Like

still it is too long

Perhaps you could split it into two commands. Let’s call them !subcount and _subcount:

!addcom -cd=5 !subcount -a=_subcount https://www.googleapis.com...

Replace the entire link above.

!addcom -cd=5 _subcount $(eval a=$(urlfetch json $(query));try{a.items[0].statistics.subscriberCount;}catch(e){`Error!`;})
1 Like

it works perfect bro <3 thank you u are such a kind person,

previously i asked u about girl boy commands,
!girl command have error
sometimes it is not increasing,

i mean when i send !girl

it replies 0 girl girl have bee joined , yes i tried with fresh account , i dint not send !boy command before !girl

I am not sure why they aren’t working. I have the same exact commands set up in my chat and they’re working fine. Maybe you can private message me with the commands and I’ll try to see what’s wrong.

If you private message me the commands, make sure to copy and paste the commands exactly as they are, and with the appropriate formatting, ie make sure each command setup looks like this:

Example text.

To do this, put 4 spaces in front of each command.

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