diff --git a/ethzlunch/__init__.py b/ethzlunch/__init__.py index 7b67996e5f236f91758d86efd47c7b7d7c618e4a..a58b8c4c40fe60c512423c6182466338f1e0b4c1 100644 --- a/ethzlunch/__init__.py +++ b/ethzlunch/__init__.py @@ -1 +1 @@ -from .bot import ReminderBot +from .bot import ETHzLunchBot diff --git a/ethzlunch/bot.py b/ethzlunch/bot.py index 9652983c6f2b024504fb10c0e866804eac99b4a3..4fe720dcc011aefa0eb08a12c70979819ba8bea9 100644 --- a/ethzlunch/bot.py +++ b/ethzlunch/bot.py @@ -25,7 +25,7 @@ from mautrix.util.async_db import UpgradeTable from mautrix.util.config import BaseProxyConfig, ConfigUpdateHelper from .migrations import upgrade_table -from .db import ReminderDatabase +from .db import ETHzLunchDatabase from .util import validate_locale, validate_timezone, CommandSyntaxError from .reminder import Reminder from .ethz import (parse_facilities, parse_menus, filter_facilities, markdown_facilities, @@ -49,14 +49,14 @@ class Config(BaseProxyConfig): helper.copy("default_facilities") -class ReminderBot(Plugin): +class ETHzLunchBot(Plugin): base_command: Tuple[str, ...] hunger_command: Tuple[str, ...] default_timezone: pytz.timezone admin_power_level: int scheduler: AsyncIOScheduler reminders: Dict[EventID, Reminder] - db: ReminderDatabase + db: ETHzLunchDatabase url_facilities: str url_menus: str @@ -71,7 +71,7 @@ class ReminderBot(Plugin): async def start(self) -> None: self.scheduler = AsyncIOScheduler() self.scheduler.start() - self.db = ReminderDatabase(self.database) + self.db = ETHzLunchDatabase(self.database) self.on_external_config_update() self.reminders = await self.db.load_all(self) @@ -245,7 +245,8 @@ class ReminderBot(Plugin): f"Available price categories: `int`, `ext`, `stud`\n" f"Disable prices in menus: `off`") - @lunch.subcommand("remind", help="Create reminder (time: `hh:mm`, days default: `mon-fri`)") + @lunch.subcommand("remind", aliases=["reminder"], + help="Create reminder (time: `hh:mm`, days default: `mon-fri`)") @command.argument("time", matches="[0-9]{1,2}:[0-9]{2}") @command.argument("days", required=False) @command.argument("canteens", required=False, pass_raw=True) diff --git a/ethzlunch/db.py b/ethzlunch/db.py index fdf58ec5a205e7b7401031ef45cdd3876d0050bb..f10baed0cf31ebb3758204bb726bc697512113c6 100644 --- a/ethzlunch/db.py +++ b/ethzlunch/db.py @@ -29,7 +29,7 @@ from mautrix.types import UserID, EventID, RoomID if TYPE_CHECKING: - from .bot import ReminderBot + from .bot import ETHzLunchBot from .reminder import Reminder @@ -37,7 +37,7 @@ from .reminder import Reminder logger = logging.getLogger(__name__) -class ReminderDatabase: +class ETHzLunchDatabase: cache: DefaultDict[UserID, UserInfo] db: Database defaults: UserInfo @@ -125,7 +125,7 @@ class ReminderDatabase: reminder.is_agenda, reminder.creator) - async def load_all(self, bot: ReminderBot) -> Dict[EventID, Reminder]: + async def load_all(self, bot: ETHzLunchBot) -> Dict[EventID, Reminder]: """ Load all reminders in the database and return them as a dict for the main bot Args: bot: it feels dirty to do it this way, but it seems to work and make code cleaner diff --git a/ethzlunch/reminder.py b/ethzlunch/reminder.py index 1b1cb9784a5eebae8b4e1efc3eeae37a97d70364..af4e2ea4385da31856f8fb7cbb3bf90c7a379764 100644 --- a/ethzlunch/reminder.py +++ b/ethzlunch/reminder.py @@ -18,7 +18,7 @@ except ImportError: USE_CRON_DESCRIPTOR = False if TYPE_CHECKING: - from .bot import ReminderBot + from .bot import ETHzLunchBot logger = logging.getLogger(__name__) @@ -26,7 +26,7 @@ logger = logging.getLogger(__name__) class Reminder(object): def __init__( self, - bot: ReminderBot, + bot: ETHzLunchBot, room_id: RoomID, message: str, event_id: Optional[EventID] = None, diff --git a/maubot.yaml b/maubot.yaml index d80bb2edb449ab0dca887e01631a5d90fd31f1ec..e537c2a2f41013c8f545eab07a1f10f0f1108dd3 100644 --- a/maubot.yaml +++ b/maubot.yaml @@ -3,8 +3,8 @@ id: ch.ethz.phys.lunch version: 0.0.2 license: AGPL-3.0-or-later modules: -- reminder -main_class: ReminderBot +- ethzlunch +main_class: ETHzLunchBot extra_files: - base-config.yaml dependencies: