First off, if this all seems incredibly janky, I apologize. At this point my brain is kind of fried. I'd like to set up pushbullet notifications where if someone says my name on a specific channel, it will push that line to me.
I was originally trying to do it just in lua, but was having a hell of a time getting https (which is required by pushbullet) to work. After wasting a lot of time there, I decided to move on and just figure out how to have the trigger execute a shell script which I know will work. So I set it up to pass a parameter on.
Here is the trigger I'm using:
<triggers>
<trigger
enabled="y"
keep_evaluating="y"
match="^(.+) gossip \'.*(wyth|Wyth|WythDryden).*\'$"
regexp="y"
repeat="y"
send_to="12"
sequence="100"
>
<send>assert (utils.shellexecute ("C:/Users/Wyth/Desktop/pushbullet.sh", "%0", nil, nil, 0))</send>
</trigger>
</triggers>
and this is the shell script I'm using:
!/bin/bash
# The API Key
API_KEY="####################"
# Note Title
NOTE_TITLE="Emperia"
# Body of the Message
BODY="$1"
curl -k -u "$API_KEY": https://api.pushbullet.com/v2/pushes -d device_iden=#################### -d type=note -d title="$NOTE_TITLE" -d body="$BODY"
The trigger will successfully go off, but when I receive the pushbullet notification it only sends the first word on the line. I suspect that it's because the parameter is being sent without "" on the shellexecute, so it only sees that first word which is picked up at the $1 in the script. I tried using $a in the script but that didn't work. I also tried putting '' in various spots to no avail. Maybe it's a really easy thing I'm overlooking, or maybe it's not possible, but at this point I can't wrap my brain around it. Would anyone perhaps be able to shed some insight into which direction I should go in?
I was originally trying to do it just in lua, but was having a hell of a time getting https (which is required by pushbullet) to work. After wasting a lot of time there, I decided to move on and just figure out how to have the trigger execute a shell script which I know will work. So I set it up to pass a parameter on.
Here is the trigger I'm using:
<triggers>
<trigger
enabled="y"
keep_evaluating="y"
match="^(.+) gossip \'.*(wyth|Wyth|WythDryden).*\'$"
regexp="y"
repeat="y"
send_to="12"
sequence="100"
>
<send>assert (utils.shellexecute ("C:/Users/Wyth/Desktop/pushbullet.sh", "%0", nil, nil, 0))</send>
</trigger>
</triggers>
and this is the shell script I'm using:
!/bin/bash
# The API Key
API_KEY="####################"
# Note Title
NOTE_TITLE="Emperia"
# Body of the Message
BODY="$1"
curl -k -u "$API_KEY": https://api.pushbullet.com/v2/pushes -d device_iden=#################### -d type=note -d title="$NOTE_TITLE" -d body="$BODY"
The trigger will successfully go off, but when I receive the pushbullet notification it only sends the first word on the line. I suspect that it's because the parameter is being sent without "" on the shellexecute, so it only sees that first word which is picked up at the $1 in the script. I tried using $a in the script but that didn't work. I also tried putting '' in various spots to no avail. Maybe it's a really easy thing I'm overlooking, or maybe it's not possible, but at this point I can't wrap my brain around it. Would anyone perhaps be able to shed some insight into which direction I should go in?