gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-taldir] branch master updated: twitter DM integration with QR


From: gnunet
Subject: [taler-taldir] branch master updated: twitter DM integration with QR
Date: Fri, 08 Jul 2022 12:33:45 +0200

This is an automated email from the git hooks/post-receive script.

martin-schanzenbach pushed a commit to branch master
in repository taldir.

The following commit(s) were added to refs/heads/master by this push:
     new 202d18e  twitter DM integration with QR
202d18e is described below

commit 202d18e7c649666ec71106a316e9fbbd368df5ee
Author: Martin Schanzenbach <schanzen@gnunet.org>
AuthorDate: Fri Jul 8 12:33:41 2022 +0200

    twitter DM integration with QR
---
 scripts/taldir-validate-twitter | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/scripts/taldir-validate-twitter b/scripts/taldir-validate-twitter
index e684ea2..99ee33f 100755
--- a/scripts/taldir-validate-twitter
+++ b/scripts/taldir-validate-twitter
@@ -5,8 +5,15 @@
 # e.g.:
 # $ t authorize
 #
-TWITTER_USER=$1
+TWITTER_USER=$(echo $1 | sed 's/@//')
+TWITTER_ID=$(twurl "/2/users/by/username/$TWITTER_USER" | jq -r '.data.id')
 CODE=$2
 LINK=$(taldir-cli -l -a $1 -c $2)
+TMPFILE="qrtmp-$CODE.png"
+echo "$LINK" | qrencode -o $TMPFILE
 MESSAGE="Follow this link to complete your Taldir registration: $LINK"
-t dm $TWITTER_USER $MESSAGE
+echo "$MESSAGE to $TWITTER_ID"
+UPLOAD_RESP=$(twurl -H upload.twitter.com "/1.1/media/upload.json" -f $TMPFILE 
-F media -X POST)
+MEDIA_ID=$(echo $UPLOAD_RESP | jq -r '.media_id')
+POST_BODY=$(echo '{"event": {"type": "message_create", "message_create": 
{"target": {"recipient_id":"'$TWITTER_ID'"}, "message_data": 
{"text":"'$MESSAGE'", "attachment": {"type": "media", "media": 
{"id":"'$MEDIA_ID'"}}}}}}')
+twurl -A 'Content-type: application/json' -X POST 
/1.1/direct_messages/events/new.json -d "$POST_BODY"

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]