@@ -775,6 +775,75 @@ def _setup_committee_actions_reminders(cls) -> None:
775775 raw_committee_actions_reminders in TRUE_VALUES
776776 )
777777
778+ @classmethod
779+ def _setup_committee_actions_reminders_interval (cls ) -> None :
780+ if "COMMITTEE_ACTIONS_REMINDERS" not in cls ._settings :
781+ INVALID_SETUP_ORDER_MESSAGE : Final [str ] = (
782+ "Invalid setup order: COMMITTEE_ACTIONS_REMINDERS must be set up "
783+ "before COMMITTEE_ACTIONS_REMINDERS_INTERVAL can be set up."
784+ )
785+ raise RuntimeError (INVALID_SETUP_ORDER_MESSAGE )
786+
787+ raw_committee_actions_reminders_interval : re .Match [str ] | None = re .fullmatch (
788+ r"\A(?:(?P<seconds>(?:\d*\.)?\d+)s)?(?:(?P<minutes>(?:\d*\.)?\d+)m)?(?:(?P<hours>(?:\d*\.)?\d+)h)?\Z" ,
789+ str (os .getenv ("COMMITTEE_ACTIONS_REMINDERS_INTERVAL" , "24h" )),
790+ )
791+
792+ raw_timedelta_committee_actions_reminders_interval : Mapping [str , float ] = {
793+ "hours" : 24 ,
794+ }
795+
796+ if cls ._settings ["COMMITTEE_ACTIONS_REMINDERS" ]:
797+ if not raw_committee_actions_reminders_interval :
798+ INVALID_COMMITTEE_ACTIONS_REMINDERS_INTERVAL_MESSAGE : Final [str ] = (
799+ "COMMITTEE_ACTIONS_REMINDERS_INTERVAL must contain the interval "
800+ "in any combination of seconds, minutes or hours."
801+ )
802+ raise ImproperlyConfiguredError (
803+ INVALID_COMMITTEE_ACTIONS_REMINDERS_INTERVAL_MESSAGE ,
804+ )
805+
806+ raw_timedelta_committee_actions_reminders_interval = {
807+ key : float (value )
808+ for key , value in (
809+ raw_committee_actions_reminders_interval .groupdict ().items ()
810+ )
811+ if value
812+ }
813+
814+ cls ._settings ["COMMITTEE_ACTIONS_REMINDERS_INTERVAL" ] = (
815+ raw_timedelta_committee_actions_reminders_interval
816+ )
817+
818+ @classmethod
819+ def _setup_committee_actions_reminders_channel (cls ) -> None :
820+ if "COMMITTEE_ACTIONS_REMINDERS" not in cls ._settings :
821+ INVALID_SETUP_ORDER_MESSAGE : Final [str ] = (
822+ "Invalid setup order: COMMITTEE_ACTIONS_REMINDERS must be set up "
823+ "before COMMITTEE_ACTIONS_REMINDERS_CHANNEL can be set up."
824+ )
825+ raise RuntimeError (INVALID_SETUP_ORDER_MESSAGE )
826+
827+ INVALID_COMMITTEE_ACTIONS_REMINDERS_CHANNEL_MESSAGE : Final [str ] = (
828+ "COMMITTEE_ACTIONS_REMINDERS_CHANNEL must be a valid name"
829+ " of a channel in your group's Discord guild."
830+ )
831+
832+ raw_committee_actions_reminders_channel : str = (
833+ os .getenv ("COMMITTEE_ACTIONS_REMINDERS_CHANNEL" , "committee-general" )
834+ .strip ()
835+ .lower ()
836+ )
837+
838+ if not raw_committee_actions_reminders_channel :
839+ raise ImproperlyConfiguredError (
840+ INVALID_COMMITTEE_ACTIONS_REMINDERS_CHANNEL_MESSAGE
841+ )
842+
843+ cls ._settings ["COMMITTEE_ACTIONS_REMINDERS_CHANNEL" ] = (
844+ raw_committee_actions_reminders_channel
845+ )
846+
778847 @classmethod
779848 def _setup_committee_actions_board (cls ) -> None :
780849 raw_committee_actions_board : str = (
@@ -817,46 +886,6 @@ def _setup_committee_actions_board_channel(cls) -> None:
817886
818887 cls ._settings ["COMMITTEE_ACTIONS_BOARD_CHANNEL" ] = raw_committee_actions_board_channel
819888
820- @classmethod
821- def _setup_committee_actions_reminders_interval (cls ) -> None :
822- if "COMMITTEE_ACTIONS_REMINDERS" not in cls ._settings :
823- INVALID_SETUP_ORDER_MESSAGE : Final [str ] = (
824- "Invalid setup order: COMMITTEE_ACTIONS_REMINDERS must be set up "
825- "before COMMITTEE_ACTIONS_REMINDERS_INTERVAL can be set up."
826- )
827- raise RuntimeError (INVALID_SETUP_ORDER_MESSAGE )
828-
829- raw_committee_actions_reminders_interval : re .Match [str ] | None = re .fullmatch (
830- r"\A(?:(?P<seconds>(?:\d*\.)?\d+)s)?(?:(?P<minutes>(?:\d*\.)?\d+)m)?(?:(?P<hours>(?:\d*\.)?\d+)h)?\Z" ,
831- str (os .getenv ("COMMITTEE_ACTIONS_REMINDERS_INTERVAL" , "24h" )),
832- )
833-
834- raw_timedelta_committee_actions_reminders_interval : Mapping [str , float ] = {
835- "hours" : 24 ,
836- }
837-
838- if cls ._settings ["COMMITTEE_ACTIONS_REMINDERS" ]:
839- if not raw_committee_actions_reminders_interval :
840- INVALID_COMMITTEE_ACTIONS_REMINDERS_INTERVAL_MESSAGE : Final [str ] = (
841- "COMMITTEE_ACTIONS_REMINDERS_INTERVAL must contain the interval "
842- "in any combination of seconds, minutes or hours."
843- )
844- raise ImproperlyConfiguredError (
845- INVALID_COMMITTEE_ACTIONS_REMINDERS_INTERVAL_MESSAGE ,
846- )
847-
848- raw_timedelta_committee_actions_reminders_interval = {
849- key : float (value )
850- for key , value in (
851- raw_committee_actions_reminders_interval .groupdict ().items ()
852- )
853- if value
854- }
855-
856- cls ._settings ["COMMITTEE_ACTIONS_REMINDERS_INTERVAL" ] = (
857- raw_timedelta_committee_actions_reminders_interval
858- )
859-
860889 @classmethod
861890 def _setup_env_variables (cls ) -> None :
862891 """
0 commit comments