mirror of
https://github.com/System-End/hackatime.git
synced 2026-04-19 19:55:16 +00:00
Add teletype printouts
This commit is contained in:
parent
257d03d56a
commit
1e9d0f2200
3 changed files with 13 additions and 0 deletions
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
11
app/jobs/sailors_log_teletype_job.rb
Normal file
11
app/jobs/sailors_log_teletype_job.rb
Normal 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
|
||||
Loading…
Add table
Reference in a new issue