Using arguments and querystring together

Hi there,
I’m trying to build a command that forwards two variables to an IFTTT webhook, the first being a single word and the second a line of text in varying length.

This is my command:
$(eval a=$(urlfetch https://webhook?value1=$(1)&value2=$(querystring)))

My issue is that $(querystring) repeats the word picked up by $(1) because it pulls the full line of text and not just everything after the first word.
I need them separated because they are used in different places. When using arguments only, like value1=$(1)&value2=$(2) I can only input two words total. Using $(query) in place of $(querystring) has the same result.

So I’m looking for a way to separate the first word from the rest, or alternatively a way to make $(querystring) ignore or remove the first word entirely, before sending it to my webhook.

Thanks for your help! <3

Hiya, you should only use $(querystring) as single variable, and split that variable on your end. From there remove the first word.

Thank you, that’s good to know! I was hoping there would be an easier way to do it with Nightbot already, but then I will have to look into how I could achieve the split. I’m not really versed in programming, so any pointers at how that might be done would be really appreciated! <3

For context, the main thing I’m trying to do is forward the message from Nightbot to IFTTT, through two webhooks, to then make a post on Discord. I need the separate variables because I want to make an embedded post on Discord, with different parts of the original Nightbot command in different places. So from what I understand, this could be done by javascript? Not sure though because I’m still very new to this.

Depends on the programming language you are using on your end. For example javascript has split() or php has explode().

Doing it on your end is the easiest way, Nightbot sends the full user message, and you can do all the parsing on your end.

Thank you! I finally had some more time to look into this and what I do know is that IFTTT can use javascript. My app is sending a Discord embed via webhook, which looks like this:

{ “embeds”:
“title”: “{{Value1}}”,
“description”: “{{Value2}}”,

I’m probably lacking the basic skills to weave a split() method into that, to remove the first word of ‘Value2’ which contains the $(querystring) from Nightbot. And this might be the wrong place to ask for IFTTT support, but is it possible to achive the same thing already in the Nightbot command by using split()?

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