Need help with Custom Command

Hi there, i am trying to add a custom command for my followers. It’s basicly !love command (user loves streamer x%) but i need to limit usage daily for everyone and wanna make exception for myself.

If any follower except me use command, bot replies as "user loves streamer (0-99)%).
If i use command, bot choose random sentence from a pastebin document.

Every user has 86400 seconds cooldown, it basicly a day.

Everything was working fine but after i added [User Command Cooldowns,]( bot doesn’t reply me with random sentence.

This is for my love command (i deleted tokens);
!addcom -cd=5 !love -a=_!command_helper $(eval z=86400;d=Date.parse(Date());a=$(urlfetch json$(user)~\d+~/g);PRIVATE_TOKEN+(!a||d-parseInt(a[a.length-1].split(~)[2])>=z*1000?&data=~$(user)~${d}~:``))

And here _!command_helper;

!addcom -cd=5 _!command_helper $(eval a=$(urlfetch$(query));decodeURIComponent($(querystring)).includes(PRIVATE_TOKEN)?(a.includes(Successfully added entry)?$(eval r = $(urlfetch; if ('$(user)' == 'mynickname') "$(eval a=$(urlfetch json|);a[Math.floor(Math.random()*a.length)])"; else '$(user), loves %' +r+ ' streamer!';):One usage per!): )

Please help me. If need any more information, i can provide.

Hey @foxybiscuit!

Please format your code so it’s easy to read.

You can use this button:
or put it on a new line after four spaces (the line before it must be empty):

empty line

or put it between three backticks on the line before and the line after:


Thank you @Emily

i actually fixed my problem but i need some help on another problem.

This is my !love command;

$(eval z=14400;d=Date.parse(Date());a=`$(urlfetch json`.match(/~$(user)~\d+~/g);`Public_Token`+(!a||d-parseInt(a[a.length-1].split(`~`)[2])>=z*1000?`&data=~$(user)~${d}~`:``))

and this is my _!command_helper (alias of !love) command;

$(eval a=`$(urlfetch$(query))`;decodeURIComponent(`$(querystring)`).includes(`Public_Token`)?(a.includes(`Successfully added entry`)?`$(eval r = $(urlfetch; if ('$(user)' == 'myNickName') {a=`$(urlfetch json`.split(`|`);a[Math.floor(Math.random()*a.length)];} else {'$(user), beni %' + r + ' seviyor!';})`:`@$(user) Her yayında 1 kez kullanılabilir!`):` `)

So basicly if “anyone” write !love in chat, bot output is like this: anyone, beni %xx seviyor!

Now i want to do that, if xx<15 ‘something’, elseif 15<xx<50 ‘something1’ or ‘something2’ else ‘something3’ or ‘something4’ or ‘something5’.

how i can set that? i know that i need to use pastebin but how can bot read pastebin codes?

1 Like

You can write code in your Pastebin and the bot will read it just fine.

If it’s just to extract an array, that’s your Pastebin content:

sentence 1|
sentence 2|
sentence N

and then your Nightbot code:

$(eval p='$(urlfetch json'.split('|');)

If it’s to execute code, that’s your Pastebin content:

your extra JS code

and then your Nightbot code:

$(eval $(urlfetch json

But I assume you’re looking for a combination of both, so that’s your Pastebin content:

array = ['sentence 1', 'sentence 2', ... , 'sentence N'];
your extra JS code

and then your Nightbot code:

$(eval $(urlfetch json

I also recommend reading this topic:

1 Like

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