From 12456783ad32c7671d268cb2aebcedfb48293a2d Mon Sep 17 00:00:00 2001 From: bralbra Date: Fri, 27 Sep 2024 04:42:03 -0400 Subject: [PATCH] stub for kick.com --- src/bot/dialogs/user/channel/add/on_click.py | 9 +++++++++ src/constants.py | 2 +- src/db/dao/base.py | 2 +- src/db/dao/message_log.py | 6 ------ 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/bot/dialogs/user/channel/add/on_click.py b/src/bot/dialogs/user/channel/add/on_click.py index b14cb56..29b94b6 100644 --- a/src/bot/dialogs/user/channel/add/on_click.py +++ b/src/bot/dialogs/user/channel/add/on_click.py @@ -9,6 +9,8 @@ Button, ) +from src.db.models.channel_type import ChannelType + async def on_finish( callback: CallbackQuery, button: Button, manager: DialogManager @@ -26,6 +28,13 @@ async def on_select_channel_type( manager: DialogManager, item_id: str, ): + # temporary stub + # wait for https://github.com/bralbral/telegram-stream-notifier/issues/114 + if item_id == ChannelType.KICK: + await callback.answer( + "Notifications from Kick.com do not implemented. Try later." + ) + return manager.dialog_data["selected_channel_type"] = item_id await manager.next() diff --git a/src/constants.py b/src/constants.py index 5f698bc..c1e2f5e 100755 --- a/src/constants.py +++ b/src/constants.py @@ -8,7 +8,7 @@ SQLITE_DATABASE_FILE_PATH: str = os.environ.get( "SQLITE_DATABASE_FILE_PATH", os.path.join(ROOT_DIR, "youtube-notifier-bot.db") ) -VERSION: str = "2024-09-26.11" +VERSION: str = "2024-09-27.04" __all__ = [ "CONFIG_FILE_PATH", diff --git a/src/db/dao/base.py b/src/db/dao/base.py index b12db1b..14ebb7b 100644 --- a/src/db/dao/base.py +++ b/src/db/dao/base.py @@ -22,7 +22,7 @@ def __init__(self, session: AsyncSession, model: Type[T]): @property def __prepare_select_statement(self): - statement = select(self.model) + statement = select(self.model).order_by(self.model.id.desc()) return statement @abstractmethod diff --git a/src/db/dao/message_log.py b/src/db/dao/message_log.py index cf5b34e..a00df08 100644 --- a/src/db/dao/message_log.py +++ b/src/db/dao/message_log.py @@ -2,7 +2,6 @@ from typing import Sequence from sqlalchemy.ext.asyncio import AsyncSession -from sqlmodel import select from .base import BaseDAO from src.db.models import MessageLogModel @@ -12,11 +11,6 @@ class MessageLogDAO(BaseDAO[MessageLogModel]): def __init__(self, session: AsyncSession): super().__init__(session, MessageLogModel) - @property - def __prepare_select_statement(self): - statement = select(self.model).order_by(self.model.id) - return statement - async def get_first(self, *args, **kwargs) -> Optional[MessageLogModel]: return await super().get_first(*args, **kwargs)