Add teletype printouts

This commit is contained in:
Max Wofford 2025-02-24 21:21:40 -05:00
parent 257d03d56a
commit 1e9d0f2200
3 changed files with 13 additions and 0 deletions

View file

@ -8,6 +8,7 @@ SLACK_SIGNING_SECRET=your_signing_secret_here
# Sailors' log slack app
SLACK_SAILORS_LOG_SIGNING_SECRET=your_signing_secret_here
SLACK_SAILORS_LOG_BOT_OAUTH_TOKEN=your_bot_oauth_token_here
TELETYPE_API_KEY=your_teletype_api_key_here
WAKATIME_DATABASE_URL=your_wakatime_database_url_here

View file

@ -40,6 +40,7 @@ class SailorsLogPollForChangesJob < ApplicationJob
GoodJob::Bulk.enqueue do
log.notifications.where(sent: false).each do |notification|
notification.notify_user!
SailorsLogTeletypeJob.perform_later(notification.message)
end
end
end

View file

@ -0,0 +1,11 @@
class SailorsLogTeletypeJob < ApplicationJob
queue_as :default
def perform(message)
HTTP.auth("Bearer #{ENV['TELETYPE_API_KEY']}")
.post("https://printer.schmitworks.dev/api/raw",
body: {
text: message
})
end
end