Tag multiple random people in chat

Hi,

I have a question about topic mentioned before here

The code i founded is working, but when i am using “!slap 3” names of tagged people are merged into one and there is no space between. >> like this !slap 3 response is [name1name2name3] i want it to be [name1, name2, name3].

Thank you

Hiya, what does your current command look like?

!addcom -cd=5 !slap $(user) has slapped $(eval a=JSON.parse($(urlfetch json http://tmi.twitch.tv/group/user/$(channel)/chatters)).chatters;b=a.moderators.concat(a.staff,a.admins,a.global_mods,a.viewers);c=decodeURIComponent($(querystring));if(c==``){d=1;}else{e=parseInt(c);if(e!=NaN&&e>0&&e<=b.length){d=e;}else{d=1;}}f=“”;for(i=0;i<d;i++){g=Math.floor(Math.random()*b.length);f+=b[g];b.splice(g,1);}f).

Try this:

!addcom -cd=5 !slap $(user) has slapped $(eval r=[]; a=JSON.parse(`$(urlfetch json http://tmi.twitch.tv/group/user/$(channel)/chatters)`).chatters;b=a.moderators.concat(a.staff,a.admins,a.global_mods,a.viewers);c=decodeURIComponent(`$(querystring)`);if(c==``){d=1;}else{e=parseInt(c);if(e!=NaN&&e>0&&e<=b.length){d=e;}else{d=1;}}for(i=0;i<d;i++){g=Math.floor(Math.random()*b.length);r.push(b[g]);b.splice(g,1);}r.join(', ')).
1 Like

Thank you very much for quick answer. Its working like a charm. Thank you for everything you are doing for community.

Regards

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