Make a command out of other commands input

Hi,

We have a poker discord server. Whenever someone makes a final table they can use the command !ft, and nightbot responds with Hey [user], good luck on FT number xx of our discord server. Everytime someone uses this the number increases by one.

I would like to make a command which is something like !count, which takes the number of final tables reached for our Discord server. This would look like this:

Hey [user], our Discord server has had [input the amount of FT’s from the other command] so far.

Is it possible to make that happen with nightbot in Discord?

You want two commands:

!ft with response: Hey $(user), good luck on FT number XX of our Discord server.

!count with response: Hey $(user), our Discord server has had XX FT’s so far.

There are two ways you can do this. The first is a simple solution which basically achieves what you want, but the responses for the commands won’t be exactly what you want. The second achieves everything you want, but is more complex and requires a bit of work from you to implement. I strongly suggest reading both ways before deciding which way you want to go.

1: Simple way:

Copy and paste these commands into Discord or Twitch chat (whichever one in which Nightbot is present and you have moderator powers):

!addcom -cd=5 !count Our Discord server has had 0 FT's so far.
!addcom -cd=5 !ft -a=!editcom !count Our Discord server has had $(count) FT's so far.

!count will show the current counter value. Its response will be: Our Discord server has had XX FT’s so far.

!ft has a $(count) variable which is a counter value which increases by 1 every time you run the command. It edits !count to show the new counter value. Unfortunately its response will look like this and can’t be changed: @$(user) -> The command “!count” has been edited successfully.

2: Complex way:

This method uses ehsankia’s quote list CustomAPI - read more about it here.

Click this link. It will generate three links and two tokens, a public token (8 characters long) and a private token (16 characters long). The public token is located within the first generated link. The private token is located within both the second and third generated links. The tokens are found after token= and before &data=$(querystring) Copy them and keep them somewhere safe!

Either copy and paste these commands into Discord or Twitch chat (whichever one in which Nightbot is present and you have moderator powers) OR add these commands through the Nightbot dashboard. Replace PUBLIC_TOKEN with your public token and PRIVATE_TOKEN with your private token.

IMPORTANT: It is safer to add the commands through the dashboard. Add the commands through chat ONLY if you are sure no one else is there, otherwise they might see your private token!

!addcom -cd=5 !count Hey $(user), our Discord server has had $(eval '$(urlfetch http://twitch.center/customapi/quote/list?token=PUBLIC_TOKEN)'.split('.').length-1) FT's so far.
!addcom -cd=5 !ft Hey $(user), good luck on FT number $(eval a='$(urlfetch http://twitch.center/customapi/addquote?token=PRIVATE_TOKEN&data=e)';'$(urlfetch http://twitch.center/customapi/quote/list?token=PUBLIC_TOKEN)'.split('.').length-1) of our Discord server.

!count will show the value by pulling information from the Custom API (the link in $(urlfetch)). Its response will be: Hey $(user), our Discord server has had XX FT’s so far.

!ft makes a request to the Custom API adding information to increase the amount, then show the value. Its response will be: Hey $(user), good luck on FT number XX of our Discord server.

Thank you so much for your very extensive and clear explanation, i’ll try this out! I’ll let you know if it worked

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