Command that only works if channel is online

hi, i wass trying to od a command that only worcks when im streaming cuz if ppl use it when im offline its weird im talking about !song info comand i have this:

$(twitch $(channel) “{{uptimeLength}}”)(eval u=‘$(twitch $(channel) “{{uptimeLength}}”)’; if(u===‘channel is not live’){‘Just offline’} else{‘$(lastfm LASTFMNAMEACC “{{title}} by {{artist}}”)’})

someone know how to do it?

u’re pretty much there, i would only make a few minor alterations…

$(eval u=`$(twitch $(channel) "{{uptimeLength}}")’; if(u.toLowerCase()===`channel is not live`){`Just offline`} else{`$(lastfm LASTFMNAMEACC "{{title}} by {{artist}}")`})
1 Like

Damn ty man now i seems that works but sadly my idea of ‘$(twitch $(channel) “{{uptimeLength}}”) doesnt works just appear Invalid or unexpected token have any idea to know if channel is streaming or not? sry for my bad english ;-;

yeah, sorry, i copy pasted what u had… this thing messes up the quotes… i just edited it, try to copy paste it again with the update

idk what means but now tells me “invalid identifier” im bad at programing also test it other way:

$(eval u=`$(customapi’; if(u.toLowerCase()===`URCHANNEL is offline`){`Just offline`} else{`$(lastfm LASTFMNAME "{{title}} by {{artist}}")`})

and keep giving me “invalid identifier” idk think just weird, ty so much for the help!

it seems like the issue is with the $(channel) in $(twitch $(channel) "{{uptimeLength}}")… if u put the actual channel name it should work… not sure y that would give it an issue, but i actually have used that in several commands, but i always used the actual channel name when i did it

actually, nvm, i just tried it and that didn’t work either… but it works perfectly fine in this command, lol…

$(eval a="$(twitch DarthCentauri "{{uptimeLength}}")".split(" ");if(a[0]=="channel"){"Darth is not online right now, but come back on Wednesdays and Fridays at 7pm eastern time and 8pm on Saturdays. Or you can follow and catch those random streams too!"}else{b=5;c=0;d=" ";e=0;while(b==5){f=a[c][0];d+=a[c];if(f=="d"||f=="h"){d+=","};d+=" ";if(a[e]=="second"||a[e]=="seconds"){d+="and "};if(a[c]=="second"||a[c]=="seconds"){b=9};c++;e=c+2};"Darth has been kickin ass and takin names for"+d})

wow, that is old code, i wouldn’t do it like that anymore XD

1 Like

Ur a goat TY SO MUCH lul

well… i’m not sure what i did, but i fixed it, lol… at least the offline part… no idea what that music stuff is or if it works… but here ya go ^^

	$(eval u=`$(twitch $(channel) "{{uptimeLength}}")`;if(u.toLowerCase()===`channel is not live`){`Just offline`} else{`$(lastfm LASTFMNAMEACC "{{title}} by {{artist}}")`})
1 Like

tf u do man its 99 times ez code and now works cant belive ty so much atleast my 1st idea works only need someone to fix it XDDD nightbot should just add only online command option :slight_smile:

lol, no problemo ^^ and i found it, when i updated the quotes, i missed one… oops, lol

1 Like

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