about summary refs log tree commit diff
path: root/app/lib
diff options
context:
space:
mode:
authormultiple creatures <dev@multiple-creature.party>2019-12-23 12:00:35 -0600
committermultiple creatures <dev@multiple-creature.party>2019-12-23 12:00:35 -0600
commitcb45e721ecf7ff7f98ee342bd7b8a224093a14b8 (patch)
treea8e24bb2eac85c579ef33ef9e9ce4f6c0dcefe6b /app/lib
parent806199ed4ae23fd165397b41405523e672c7e090 (diff)
add `queued:boosts` & `queued:posts` bangtags
Diffstat (limited to 'app/lib')
-rw-r--r--app/lib/bangtags.rb21
1 files changed, 21 insertions, 0 deletions
diff --git a/app/lib/bangtags.rb b/app/lib/bangtags.rb
index a9b7d747b..fb502ea70 100644
--- a/app/lib/bangtags.rb
+++ b/app/lib/bangtags.rb
@@ -888,6 +888,27 @@ class Bangtags
           end
           output = ['<em>No action.</em>'] if output.blank?
           chunk = output.join("\n") + "\n"
+        when 'queued', 'scheduled'
+          chunk = nil
+          next if cmd[1].nil?
+          case cmd[1].downcase
+          when 'boosts', 'repeats'
+            output = ["# Queued boosts\n"]
+            @account.queued_boosts.find_each do |q|
+              output << "\\- [#{q.status_id}](#{TagManager.instance.url_for(q.status_id)})"
+            end
+            service_dm('announcer', @account, output.join("\n"))
+          when 'posts', 'statuses', 'roars'
+            output = ["<h1>Queued roars</h1><br>"]
+            @account.scheduled_statuses.find_each do |s|
+              preview = s.params['spoiler_text'] || s.params['text']
+              preview = '[no body text]' if preview.blank?
+              preview = preview[0..50]
+              preview = html_entities.encode(preview)
+              output << "- <a href=\"#{TagManager.instance.url_for(s.status_id)}\">#{preview}</a>"
+            end
+            service_dm('announcer', @account, output.join("<br>"), content_type: 'text/html')
+          end
         end
       end