FMK Command issues

Asked Dec 22, 2022·1 reply·Last activity 3 years ago·Open in Discord ↗
Archived from the original community forum
Things may have changed since it was written. Still stuck? Ask the community on Discord.

Command i am putting in Error i am getting Unexpected token '%'

Any help please?

$(eval r=$(urlfetch json http://tmi.twitch.tv/group/user/$(channel)/chatters);try%7Bc=JSON.parse(r).chatters;a=c.vips.concat(c.moderators,c.staff,c.admins,c.global_mods,c.viewers).filter(n=%3E![Nightbot,UnwantedUser3].some(o=%3En.toLowerCase()==o.toLowerCase()));t=[];if(a.length<3) throw not enough chatters in chat;for(i=0;i<3;i++){t.push(a.splice(Math.floor(Math.random()*a.length),1))}$(user), fuck ${t[0]}, marry ${t[1]}, kill ${t[2]}}catch(e){Error: ${e}.slice(0,400)})

1 reply

Hey @Lanky Lobster!

Please format your code as such, for example: put four spaces before it.

Syntax is your biggest issue actually: there's no string quotes in your code, and some of your characters were URL encoded (hence the Unexpected token ‘%’ error).

I think you got it from this post, the way they formatted their code removed the required backticks, you wouldn't have had the issue if you edited the previous code in the post the way they did it: "just replace the letters A, B, C with the words you want"; but that doesn't explain the URL encoded characters, perhaps you pasted the code in a URL bar and pressed enter?

Anyway, here's the fix:

$(eval r='$(urlfetch json http://tmi.twitch.tv/group/user/$(channel)/chatters)';try{c=JSON.parse(r).chatters;a=c.vips.concat(c.moderators,c.staff,c.admins,c.global_mods,c.viewers).filter(n=>!['Nightbot','UnwantedUser3'].some(o=>n.toLowerCase()==o.toLowerCase()));t=[];if(a.length<3) throw 'not enough chatters in chat';for(i=0;i<3;i++){t.push(a.splice(Math.floor(Math.random()*a.length),1))}`$(user), fuck ${t[0]}, marry ${t[1]}, kill ${t[2]}`}catch(e){`Error: ${e}`.slice(0,400)})