forked from NARKOZ/hacker-scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
hangover.rb
executable file
·37 lines (27 loc) · 758 Bytes
/
hangover.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/usr/bin/env ruby
# Skip on weekends
exit if Time.now.saturday? || Time.now.sunday?
# Exit early if sessions with my username are found
exit if `who -q`.include? ENV['USER']
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'
excuse = [
'Locked out',
'Pipes broke',
'Food poisoning',
'Not feeling well'
].sample
# Send a text message
@twilio.messages.create(
from: my_number, to: number_of_boss,
body: "Gonna work from home. #{excuse}"
)
# Log this
puts "Message sent at: #{Time.now} | Excuse: #{excuse}"