2015-11-21 23:04:28 +04:00
|
|
|
#!/usr/bin/env ruby
|
|
|
|
|
2015-11-24 03:46:12 +04:00
|
|
|
# Exit early if no sessions with my username are found
|
2015-11-27 11:32:10 +01:00
|
|
|
exit unless `who -q`.include? ENV['USER']
|
2015-11-21 23:04:28 +04:00
|
|
|
|
|
|
|
require 'dotenv'
|
|
|
|
require 'twilio-ruby'
|
|
|
|
|
|
|
|
Dotenv.load
|
|
|
|
|
|
|
|
TWILIO_ACCOUNT_SID = ENV['TWILIO_ACCOUNT_SID']
|
|
|
|
TWILIO_AUTH_TOKEN = ENV['TWILIO_AUTH_TOKEN']
|
|
|
|
|
|
|
|
@twilio = Twilio::REST::Client.new TWILIO_ACCOUNT_SID, TWILIO_AUTH_TOKEN
|
|
|
|
|
|
|
|
# Phone numbers
|
|
|
|
my_number = '+xxx'
|
|
|
|
her_number = '+xxx'
|
|
|
|
|
2015-11-25 22:09:41 +04:00
|
|
|
reason = [
|
2015-11-21 23:04:28 +04:00
|
|
|
'Working hard',
|
|
|
|
'Gotta ship this feature',
|
|
|
|
'Someone fucked the system again'
|
2015-11-25 22:09:41 +04:00
|
|
|
].sample
|
2015-11-25 11:18:30 +01:00
|
|
|
|
2015-11-21 23:04:28 +04:00
|
|
|
# Send a text message
|
|
|
|
@twilio.messages.create(
|
2015-11-25 22:09:41 +04:00
|
|
|
from: my_number, to: her_number, body: "Late at work. #{reason}"
|
2015-11-21 23:04:28 +04:00
|
|
|
)
|
|
|
|
|
|
|
|
# Log this
|
2015-11-25 22:09:41 +04:00
|
|
|
puts "Message sent at: #{Time.now} | Reason: #{reason}"
|