# █ █ █ █▄▀ ▄▀█ █▀▄▀█ █▀█ █▀█ █ █ # █▀█ █ █ █ █▀█ █ ▀ █ █▄█ █▀▄ █▄█ # 🔒 Licensed under the GNU GPLv3 # 🌐 https://www.gnu.org/licenses/agpl-3.0.html # 👤 https://t.me/hikamoru # meta developer: @hikamorumods # meta banner: https://raw.githubusercontent.com/AmoreForever/assets/master/Alarm.jpg import re import pytz import random import logging import asyncio from datetime import datetime from .. import utils, loader logger = logging.getLogger(__name__) day_to_weekday = { "mon": 0, "tue": 1, "wed": 2, "thu": 3, "fri": 4, "sat": 5, "sun": 6, "пн": 0, "вт": 1, "ср": 2, "чт": 3, "пт": 4, "сб": 5, "вс": 6, } @loader.tds class AlarmMod(loader.Module): """Alarm module for remind you about something""" strings = { "name": "Alarm", "set": " Alarm set for {}!", "unset": " Alarm for {} unset!", "unset_all": " All alarms unset!", "list_item": ( " Alarm for {}! #{}" "\n🕔 Time: {}" "\n🔊 Message: {}" ), "no_alarms": "🙅‍♂️ No alarms!", "off_button": "✋ Off", "notification": "⏰ Alarm!\n\n{}", "turned_off": "✔️ Alarm turned off!", "incorrect_time": "🖕 Incorrect time!", "where_args": "🖕 Where arguments?", "incorrect_args": "🖕 Incorrect arguments! Write like this: .setalarm mon 12:00 text", "interval_doc": "Interval of sending notifications in seconds", "time_zone_doc": "Time zone for alarms (for example, Europe/Moscow)", } strings_ru = { "set": " Напоминание установлено на {}!", "unset": " Напоминание для {} отменено!", "unset_all": " Все напоминания отменены!", "list_item": ( " Напоминание для {}! #{}" "\n🕔 Время: {}" "\n🔊 Сообщение: {}" ), "no_alarms": "🙅‍♂️ Нет напоминаний!", "off_button": "✋ Выключить", "notification": "⏰ Напоминание!\n\n{}", "turned_off": "✔️ Напоминание выключено!", "incorrect_time": "🖕 Неправильное время!", "where_args": "🖕 Где аргументы?", "incorrect_args": "🖕 Неправильные аргументы! Пиши так: .setalarm пн 12:00 текст", "interval_doc": "Интервал отправления напоминаний в секундах", "time_zone_doc": "Часовой пояс для напоминаний (например, Europe/Moscow)", } def __init__(self): self.config = loader.ModuleConfig( loader.ConfigValue( "interval", 5, lambda: self.strings("interval_doc"), validator=loader.validators.Integer(minimum=1, maximum=60), ), loader.ConfigValue( "time_zone", "Europe/Moscow", lambda: self.strings("time_zone_doc"), validator=loader.validators.RegExp( r"^[\w/]+$", ) ), ) @loader.command(ru_doc="<день недели> <время> <сообщение> - установить напоминание") async def setalarm(self, message): """