-
Notifications
You must be signed in to change notification settings - Fork 92
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
getting the cited-id from a newly posted tweet? #147
Comments
For anyone who's interested, this is possible! just needs a little bit of a workaround, because while Using update-status as an example, you can tweak Before: ((eq command 'update-status)
;; Post a tweet.
(let* ((status (cdr (assq 'status args-alist)))
(id (cdr (assq 'in-reply-to-status-id args-alist)))
(host twittering-api-host)
(method "1.1/statuses/update")
(http-parameters
`(("status" . ,status)
,@(when id `(("in_reply_to_status_id" . ,id)))))
(format-str "json"))
(twittering-http-post account-info-alist host method http-parameters
format-str additional-info))) After: ((eq command 'update-status)
;; Post a tweet.
(let* ((status (cdr (assq 'status args-alist)))
(sentinel (cdr (assq 'sentinel args-alist))) ;; added this line
(id (cdr (assq 'in-reply-to-status-id args-alist)))
(host twittering-api-host)
(method "1.1/statuses/update")
(http-parameters
`(("status" . ,status)
,@(when id `(("in_reply_to_status_id" . ,id)))))
(format-str "json"))
(twittering-http-post account-info-alist host method http-parameters
format-str additional-info (or sentinel 'ignore)))) ;; changed this line Then you can pass a sentinel to the request and extract the tweet id as follows: (defun my-sentinel (proc status connection-info header-info)
(message
(let ((status-line (cdr (assq 'status-line header-info)))
(status-code (cdr (assq 'status-code header-info))))
(case-string
status-code
(("200")
(let ((json-response (twittering-json-read)))
"the tweet id is: %s" (alist-get 'id json-response)))
(t
(format "Response: %s"
(twittering-get-error-message header-info connection-info)))))))
(twittering-call-api 'update-status '((status . "hello twitter")
(sentinel . my-sentinel)))
|
If I use code like this:
(twittering-call-api 'update-status '((status . "you got it 5")))
I can post tweets. I wonder how I can get the cited-id for that tweet though, so I can reply to it in a thread. Any hints?
The text was updated successfully, but these errors were encountered: