|
1 |
| -namespace Hacker_Scripts |
| 1 | +using Twilio; |
| 2 | +using Twilio.Rest.Api.V2010.Account; |
| 3 | + |
| 4 | +//Exit early if any session with my username is found |
| 5 | +if (args[0] is null) |
2 | 6 | {
|
3 |
| - using System; |
4 |
| - using Twilio; |
5 |
| - using System.Linq; |
6 |
| - |
7 |
| - class Hangover |
8 |
| - { |
9 |
| - public static string TWILIO_ACCOUNT_SID = Environment.GetEnvironmentVariable("TWILIO_ACCOUNT_SID"); |
10 |
| - public static string AUTH_TOKEN = Environment.GetEnvironmentVariable("TWILIO_AUTH_TOKEN"); |
11 |
| - |
12 |
| - public static string YOUR_NUMBER = "9879789978"; |
13 |
| - public static string BOSS_NUMBER = "3213213233"; |
14 |
| - |
15 |
| - static void Main(string[] args) |
16 |
| - { |
17 |
| - var twilio = new TwilioRestClient(TWILIO_ACCOUNT_SID, AUTH_TOKEN); |
18 |
| - |
19 |
| - string[] randomMessages = { |
20 |
| - "Locked out", |
21 |
| - "Pipes broke", |
22 |
| - "Food poisoning", |
23 |
| - "Not feeling well" |
24 |
| - }; |
25 |
| - |
26 |
| - int randomIndex = new Random().Next(randomMessages.Count()); |
27 |
| - String messageToSend = (randomMessages[randomIndex]); |
28 |
| - |
29 |
| - var message = twilio.SendMessage(YOUR_NUMBER, BOSS_NUMBER, messageToSend); |
30 |
| - Console.WriteLine(message.Sid); |
31 |
| - } |
32 |
| - } |
| 7 | + return; |
33 | 8 | }
|
34 | 9 |
|
| 10 | +var twilioAccountSid = Environment.GetEnvironmentVariable("TWILIO_ACCOUNT_SID"); |
| 11 | +var authToken = Environment.GetEnvironmentVariable("TWILIO_AUTH_TOKEN"); |
| 12 | + |
| 13 | +//Phone numbers |
| 14 | +const string myNumber = "+xxx"; |
| 15 | +const string numberOfBoss = "+xxx"; |
| 16 | + |
| 17 | +TwilioClient.Init(twilioAccountSid, authToken); |
| 18 | + |
| 19 | +string[] excuses = { |
| 20 | + "Locked out", |
| 21 | + "Pipes broke", |
| 22 | + "Food poisoning", |
| 23 | + "Not feeling well" |
| 24 | +}; |
| 25 | + |
| 26 | +var rand = new Random().Next(excuses.Length); |
| 27 | +var message = $"Gonna work from home. {excuses[rand]}"; |
| 28 | + |
| 29 | +//Send a text message |
| 30 | +var response = MessageResource.Create( |
| 31 | + body: message, |
| 32 | + from: new Twilio.Types.PhoneNumber(myNumber), |
| 33 | + to: new Twilio.Types.PhoneNumber(numberOfBoss) |
| 34 | +); |
| 35 | + |
| 36 | +Console.WriteLine(response.Sid); |
0 commit comments