''Replace/else'' command

Been working on this !setmulti to easily make a multi twitch command. Most of the command works fine, but can’t get the ‘‘replace’’ @ part of it and for some reason, I cant take it out without ruining the ‘‘else’’ part? if anyone could help me it would be nice!

!addcom !setmulti -ul=mod -cd=5 -a=!editcom !multi $(eval streams = $(query).replace(/^@*/, “”); if (streams){Playing with fellow streamers: twitch.tv/$(eval const streams = '$(query)'.split(" "); streams.join( " || twitch.tv/");) || Watch them all here: multistre.am/$(channel)/$(eval const streams = '$(query)'.split(" "); streams.join( "/");)/}else{“No multi active”})

It’s because your regex of /^@*/ matches indefinitely.

Also this seems a bit much for something that can be made with basic variables, example.

!addcom !setmulti -ul=mod -cd=5 -a=!editcom !multi $(eval streams = decodeURIComponent(`$(querystring)`).replace(/@/g, "").split(" ").filter(stream => stream.length > 0).map(stream => encodeURIComponent(stream)); streams.length > 0 ? `Playing with fellow streamers: twitch.tv/${streams.join(" || twitch.tv/")} || Watch them all here: multistre.am/$(channel)/${streams.join("/")}` : "No multi active")
1 Like

That works perfect :slight_smile: Thanks alot

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