Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F3764434
D748.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D748.diff
View Options
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,17 @@
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 1
+ } {
+ 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 +346,33 @@
}
}
+# Extracts the id of the status from an URL or directly from this ID
+#
+# @param text The text containing the status ID
+# @param If successful, will be set to the id of the status to retweet
+# @return 1 if successful; otherwise, 0
+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
+}
+
+# Retweets a status
+#
+# @param account The retweeting account username
+# @param status The id of the status to retweet
+# @return The API reply, as a dictionary
+proc twitter_retweet {account status} {
+ set url https://api.twitter.com/1.1/statuses/retweet/$status.json
+ twitter_query $url $account "" POST
+}
+
#
# Mail
#
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Nov 23, 05:46 (18 h, 46 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2257343
Default Alt Text
D748.diff (1 KB)
Attached To
Mode
D748: Allow to retweet to @ideedarticles with !idéert
Attached
Detach File
Event Timeline
Log In to Comment