Cybrkyd's Git Repositories

reminder-bot - commit: f21cd15

commit f21cd15986d568aea8cbe2ca944c84269db89d33146a3b2b148afb9a314f44ef
author cybrkyd <noreply@cybrkyd.com> 2026-01-22 14:36:31 +0000
committer cybrkyd <noreply@cybrkyd.com> 2026-01-22 14:36:31 +0000

Commit Message

Init

📊 Diffstat

rem.py 49
1 files changed, 49 insertions(+), 0 deletions(-)

Diff

commit f21cd15986d568aea8cbe2ca944c84269db89d33146a3b2b148afb9a314f44ef
Author: cybrkyd <noreply@cybrkyd.com>
Date: Thu Jan 22 14:36:31 2026 +0000
Init
diff --git a/rem.py b/rem.py
new file mode 100755
index 0000000..6e43654
--- /dev/null
+++ b/rem.py
@@ -0,0 +1,49 @@
+ #!/usr/bin/env python3
+
+ import csv
+ import datetime
+ import subprocess
+ import calendar
+
+ def send_email(subject, body, to_email):
+ result = subprocess.run(
+ ['mutt', '-s', subject, '--', to_email],
+ input=body,
+ capture_output=True,
+ text=True
+ )
+
+ if result.returncode != 0:
+ print(f"Error sending email: {result.stderr}")
+
+ file_path = '/full/path/to/list.csv'
+ current_day = datetime.datetime.now().day
+ current_month = datetime.datetime.now().month
+ current_date = datetime.datetime.now().strftime('%d %b')
+ current_weekday = datetime.datetime.now().strftime('%A')
+
+ to_email = 'mail@example.com'
+
+ with open(file_path, 'r') as csvfile:
+ reader = csv.DictReader(csvfile, delimiter='\t')
+
+ for row in reader:
+ subject = row['Subject']
+ occurrence = row['Occurrence']
+
+ if 'Last day of every month' in occurrence:
+ last_day_of_month = calendar.monthrange(datetime.datetime.now().year, current_month)[1]
+ if current_day == last_day_of_month:
+ send_email(subject, subject, to_email)
+
+ elif 'of every month' in occurrence:
+ day_of_month = int(occurrence.split(' ')[0])
+ if current_day == day_of_month:
+ send_email(subject, subject, to_email)
+
+ elif current_date in occurrence:
+ send_email(subject, subject, to_email)
+
+ elif current_weekday.lower() in occurrence.lower():
+ send_email(subject, subject, to_email)
+