2015-11-21 23:04:28 +04:00
|
|
|
#!/usr/bin/env ruby
|
|
|
|
|
2015-11-24 03:46:12 +04:00
|
|
|
# Exit early if sessions with my username are found
|
|
|
|
exit if `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'
|
|
|
|
number_of_boss = '+xxx'
|
|
|
|
|
2015-11-25 22:09:41 +04:00
|
|
|
excuse = [
|
2015-11-21 23:04:28 +04:00
|
|
|
'Locked out',
|
|
|
|
'Pipes broke',
|
|
|
|
'Food poisoning',
|
|
|
|
'Not feeling well'
|
2015-11-25 22:09:41 +04:00
|
|
|
].sample
|
2015-11-21 23:04:28 +04:00
|
|
|
|
|
|
|
# Send a text message
|
|
|
|
@twilio.messages.create(
|
|
|
|
from: my_number, to: number_of_boss,
|
2015-11-25 22:09:41 +04:00
|
|
|
body: "Gonna work from home. #{excuse}"
|
2015-11-21 23:04:28 +04:00
|
|
|
)
|
|
|
|
|
|
|
|
# Log this
|
2015-11-25 22:09:41 +04:00
|
|
|
puts "Message sent at: #{Time.now} | Excuse: #{excuse}"
|