$(tweet) variable handling

2022 visit: it’s fun seeing where I started, now JavaScript is my best friend.

I doubt this post will be useful to you though, as some bit of code was in a Pastebin that is now deleted.


Is the only reason why it gives me a broken link because $(tweet) doesn’t work with variables other than Nightbot’s such as $(query) for example?

I want to automate as much as possible the command by adding the regular hashtags to a Pastebin so I don’t have to type them, and at the same time I want to be able to add other hashtags if I need to while filtering out text after the !tweet that is not hashtag.

Got Twitter? Tweet out the stream. Click the link and press "Tweet". Thanks for the support! $(eval q="$(query)".split(' ');g=`$(urlfetch json https://pastebin.com/raw/JZqR5w6f)`.split(`,`);g.pop();h=[];for(i=0;i<(g.length/2);i++){if('$(twitch STREAMER "{{game}}")'==g[i]){h[h.length]=g[(g.length/2)+i];}}for(i=0;i<q.length;i++){if(q[i].charAt(0)=="#"){h[h.length]=q[i];}}`$(tweet @HANDLE is streaming on #Twitch right now! Get in here: http://twitch.tv/STREAMER ${h.join(' ');})`;)

Thanks in advance for the answer.

@Emily

Rewrote $(eval) to be a bit more compact, and nested the entire $(eval) in $(tweet):

Got Twitter? Tweet out the stream. Click the link and press "Tweet". Thanks for the support! $(tweet $(eval g=`$(urlfetch json https://pastebin.com/raw/JZqR5w6f)`.split(`,`);g.pop();h=g.indexOf(`$(twitch STREAMER "{{game}}")`);`@HANDLE is streaming on #Twitch right now! Get in here: http://twitch.tv/STREAMER ${h>=0?g[(g.length/2)+h]:``} ${decodeURIComponent(`$(querystring)`).split(` `).filter(a=>a.charAt(0)==`#`&&a.length>1&&!a.slice(1).includes(`#`)).join(` `)}`))

Once again, thank you so much! :heart:

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