Advanced counting command

Hello, I have a command that allows viewers to ban each other for fun with !ban and have !unban as well.
I want the !ban command to count how many times a certain user have been banned and not just how many times someone has been banned. Furthermore, I want the !unban to remove 1 count from the certain user.

E.g.
user1: !ban user2
nightbot: user2 has been banned 2 time(s)
user1: !unban user2

  • and either this:
    nighbot: user2 has been unbanned but is still banned 1 time(s)
  • or this:
    nightbot: user2 has been unbanned
    (and next time someone bans user2 again, nightbot would say user2 has been banned 2 time(s) again.

Is this possible in any way? and how?

1 Like

@bascounter Welcome to the community. Sorry, the feature you want is not possible by the Nightbot, as Nightbot do NOT store any single user’s information.

Please ignore my grammar.

1 Like

Okay, thanks for the answer! Have a nice day :slight_smile:

Actually it is possible try this:
First generation two tokens here https://twitch.center/customapi/quote/generate
They come inbetween token= and &data.
The 16 digit token is your private one and the 8 digit one if your public one.

!ban command:

$(urfletch $(eval a=`$(urlfetch json https://twitch.center/customapi/quote/list?token=PUBLIC_TOKEN&no_id=1)`.split(`,`);b=`$(1)`.replace(`@`,``);M=`0`;Q=` `;if(b==`null`){M=` `}else{for(i=0;i<a.length;i++){c=a[i].split(` `);if(c[0]==b){M=c[1]}}};if(M==` `){Q=` `}else{Q=`https://twitch.center/customapi/addquote?token=PRIVATE_TOKEN&data=$(1)%20${parseInt(M)+1}))

Alias this command to _ban

_ban command:

$(eval A=`$(1)`;B=$(urlfetch json https://twitch.center/customapi/quote/list?token=PUBLIC_TOKEN&no_id=1).split(`,`);C=B[B.length-1].split(` `);A==`Successfully`?`@${C[0]} has been banned ${C[1]} times.`:`Please put a name after the command`)

!unban command:

$(urfletch $(eval a=`$(urlfetch json https://twitch.center/customapi/quote/list?token=PUBLIC_TOKEN&no_id=1)`.split(`,`);b=`$(1)`.replace(`@`,``);M=`0`;Q=` `;if(b==`null`){M=` `}else{for(i=0;i<a.length;i++){c=a[i].split(` `);if(c[0]==b){M=c[1]};if(M==`0`){M=` `}}};if(M==` `){Q=` `}else{Q=`https://twitch.center/customapi/addquote?token=PRIVATE_TOKEN&data=$(1)%20${parseInt(M)-1}))

Alias command to _unban

_unban command:

$(eval A=`$(1)`;B=$(urlfetch json https://twitch.center/customapi/quote/list?token=PUBLIC_TOKEN&no_id=1).split(`,`);C=B[B.length-1].split(` `);A==`Successfully`?`@${C[0]} has been unbanned user has ${C[1]} bans left.`:`Please put a name after the command or make sure user has been banned before.`)

Make sure to replace the tokens.

Now I can’t promise this will work I just wrote it out and didn’t test it if it doesn’t work let me know and I can fix it for you later.

2 Likes

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