2021-09-26 21:24:34 +02:00
from typing import Optional
2021-08-09 00:40:15 +02:00
from data import schedule
from functions import les , config
2020-10-23 21:34:10 +02:00
from functions . database import remind
class Reminders :
def __init__ ( self ) :
rows = remind . getAllRows ( )
self . _nightlyUsers = [ int ( user [ 0 ] ) for user in rows if user [ 1 ] ]
self . _nightlyMessages = [ " Dagelijkse herinnering om Didier Nightly te doen. " , " Vrees niet, Nightly-streak-liefhebber! ' t Zenne kik, Didier, me ne reminder! " ]
2020-12-11 21:47:14 +01:00
self . nightly = { " users " : self . _nightlyUsers , " messages " : self . _nightlyMessages , " weekends " : True , " disabled " : False }
2020-10-23 21:34:10 +02:00
self . _les = [ int ( user [ 0 ] ) for user in rows if user [ 2 ] ]
self . _lesMessages = [ " Lessenrooster voor vandaag: " ]
2022-04-05 15:35:24 +02:00
self . les = { " users " : self . _les , " messages " : self . _lesMessages , " embed " : self . les_embed , " argsf " : schedule . find_minor , " embed_once " : False , " weekends " : False , " disabled " : True }
2020-10-23 21:34:10 +02:00
self . categories = [ self . nightly , self . les ]
2020-10-23 22:12:05 +02:00
2021-09-26 21:24:34 +02:00
def les_embed ( self , minor : Optional [ int ] = None ) :
2021-08-09 00:40:15 +02:00
dt = les . find_target_date ( )
s = schedule . Schedule ( dt , int ( config . get ( " year " ) ) , int ( config . get ( " semester " ) ) )
2021-09-26 21:24:34 +02:00
if minor is not None :
return s . create_schedule ( minor_roles = [ minor ] ) . to_embed ( )
2021-08-09 00:40:15 +02:00
return s . create_schedule ( ) . to_embed ( )