dev@locazia: fix start

This commit is contained in:
user 2024-04-05 12:50:43 +03:00
parent 3e16e7e3ac
commit ee4d08cb67
1 changed files with 8 additions and 3 deletions

View File

@ -1,6 +1,8 @@
from aiogram import Bot, types from aiogram import Bot, types
from datetime import datetime, timedelta from datetime import datetime, timedelta
from sqlalchemy import and_
from app.core.logger import make_log from app.core.logger import make_log
from app.core.models.messages import KnownTelegramMessage from app.core.models.messages import KnownTelegramMessage
from app.core._config import TELEGRAM_API_KEY, CLIENT_TELEGRAM_API_KEY from app.core._config import TELEGRAM_API_KEY, CLIENT_TELEGRAM_API_KEY
@ -45,9 +47,12 @@ class Wrapped_CBotChat(T, PlayerTemplates):
if message_type == 'common': if message_type == 'common':
ci = 0 ci = 0
for oc_msg in self.db_session.query(KnownTelegramMessage).filter( for oc_msg in self.db_session.query(KnownTelegramMessage).filter(
and_(
KnownTelegramMessage.type == 'common', KnownTelegramMessage.type == 'common',
KnownTelegramMessage.bot_id == self.bot_id,
KnownTelegramMessage.chat_id == self._chat_id, KnownTelegramMessage.chat_id == self._chat_id,
KnownTelegramMessage.deleted == False KnownTelegramMessage.deleted == False
)
).all(): ).all():
await self.delete_message(oc_msg.message_id) await self.delete_message(oc_msg.message_id)
ci += 1 ci += 1