-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.py
More file actions
50 lines (39 loc) · 1.34 KB
/
main.py
File metadata and controls
50 lines (39 loc) · 1.34 KB
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
38
39
40
41
42
43
44
45
46
47
48
49
50
import os
from dotenv import load_dotenv
# Load environment variables from the .env file
load_dotenv()
"""
Disclaimer: Sending unsolicited messages is unethical and may be illegal.
This script is intended for educational purposes only.
Use responsibly and only with your own phone number.
"""
def read_file(file_path):
"""Reads the file and returns its content as lines."""
if not os.path.exists(file_path):
print(f"Error: File '{file_path}' not found.")
return []
with open(file_path, 'r') as f:
text = f.read().strip()
if not text:
print("Error: File is empty.")
return []
lines = text.splitlines()
return lines
def send_message(phone_number, message):
"""Sends a message using an AppleScript command."""
if not phone_number or not message:
print("Error: Missing phone number or message.")
return
os.system(f'osascript send.scpt {phone_number} "{message}"')
def main():
# Get the phone number from environment variables
phone_number = os.getenv('PHONE_NUMBER')
if not phone_number:
print("Error: PHONE_NUMBER is not set in the .env file.")
return
lines = read_file('ly.txt')
# Send each line separately
for line in lines:
send_message(phone_number, line)
if __name__ == '__main__':
main()