Page MenuHomeDevCentral

D748.id1876.diff
No OneTemporary

D748.id1876.diff

diff --git a/Daeghrefn/Communication.tcl b/Daeghrefn/Communication.tcl
--- a/Daeghrefn/Communication.tcl
+++ b/Daeghrefn/Communication.tcl
@@ -9,6 +9,10 @@
bind pub - !idee pub:idee
bind pub - !idees pub:idee
bind pub - !idée pub:idee
+bind pub - !ideert pub:ideert
+bind pub - !idéert pub:ideert
+bind pub - !idee-rt pub:ideert
+bind pub - !idée-rt pub:ideert
#
# SMS
@@ -250,6 +254,16 @@
twitterpublish ideedarticles $nick $text
}
+#!ideert
+proc pub:ideert {nick uhost handle chan text} {
+ set status ""
+ if {[twitter_try_extract_status $text status]} {
+ twitter_retweet ideedarticles $status
+ } {
+ return 0
+ }
+}
+
#!identica
proc pub:identica {nick uhost handle chan text} {
putquick "NOTICE $nick :!identica is currently disabled. Is identi.ca still usable since pump.io migration? If so, please request the command."
@@ -331,6 +345,24 @@
}
}
+proc twitter_try_extract_status {text status} {
+ upvar 1 $status value
+
+ # Trivial case: value is already the status identifier
+ if {[isnumber $text]} {
+ set value $text
+ return 1
+ }
+
+ regexp "twitter\.com/.*/status/(\[0-9\]+)" $text matches value
+}
+
+proc twitter_retweet {account status} {
+ set url https://api.twitter.com/1.1/statuses/retweet/$status.json
+ twitter_query $url $account "" POST
+ return 1
+}
+
#
# Mail
#

File Metadata

Mime Type
text/plain
Expires
Tue, Apr 22, 07:25 (7 h, 18 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2594659
Default Alt Text
D748.id1876.diff (1 KB)

Event Timeline