28 lines
817 B
Python
28 lines
817 B
Python
"""
|
|
Script used to send notifications for review on IRC.
|
|
"""
|
|
from dataclasses import dataclass
|
|
|
|
from events import event
|
|
import settings
|
|
|
|
SCHEDULER_DELAY = 60
|
|
|
|
|
|
@dataclass
|
|
class Notification(event.Event):
|
|
callback : str = "notifications"
|
|
scheduler_type : int = event.EXECUTE_EVERY
|
|
scheduler_delay : int = SCHEDULER_DELAY
|
|
|
|
def run(self, now):
|
|
"""
|
|
Gestion du rappel avant la revue hebdomadaire
|
|
"""
|
|
for reminder in settings.REVIEW_REMINDERS:
|
|
if now.tm_hour == reminder[0] and now.tm_min == reminder[1]:
|
|
# On renvoie le nombre de minutes avant la revue hebdomadaire
|
|
minutes = (settings.REVIEW_HOUR[0] - now.tm_hour) * 60
|
|
minutes += settings.REVIEW_HOUR[1] - now.tm_min
|
|
self.callback_func(minutes)
|