Add minor changes

This commit is contained in:
AlberLC
2025-04-17 16:11:56 +02:00
parent b1c07ea251
commit ada357fcb8

View File

@@ -180,7 +180,7 @@ class BtcOffersBot(MultiBot, ABC):
( (
'', '',
'-' * 70, '-' * 70,
'<b> Los avisos de ofertas de BTC se han eliminado. Si quieres volver a recibirlos, no dudes en pedírmelo.</b>' '<b> Los avisos de ofertas BTC se han eliminado. Si quieres volver a recibirlos, no dudes en pedírmelo.</b>'
) )
) )
@@ -193,7 +193,7 @@ class BtcOffersBot(MultiBot, ABC):
try: try:
data = json.loads(await self._websocket.recv()) data = json.loads(await self._websocket.recv())
except websockets.ConnectionClosed: except websockets.ConnectionClosed:
await self.start_saved_btc_offers_notification() await self.start_saved_btc_offers_notifications()
else: else:
break break
@@ -205,7 +205,6 @@ class BtcOffersBot(MultiBot, ABC):
# ---------------------------------------------- # # ---------------------------------------------- #
# HANDLERS # # HANDLERS #
# ---------------------------------------------- # # ---------------------------------------------- #
@preprocess_btc_offers @preprocess_btc_offers
async def _on_btc_offers(self, message: Message, query: dict[str, float]): async def _on_btc_offers(self, message: Message, query: dict[str, float]):
bot_state_message = await self.send('Obteniendo ofertas BTC...', message) bot_state_message = await self.send('Obteniendo ofertas BTC...', message)
@@ -251,9 +250,9 @@ class BtcOffersBot(MultiBot, ABC):
await self.stop_btc_offers_notification(message.chat) await self.stop_btc_offers_notification(message.chat)
if previous_btc_offers_query: if previous_btc_offers_query:
await self.send('🛑 Los avisos de ofertas de BTC se han eliminado.', message) await self.send('🛑 Los avisos de ofertas BTC se han eliminado.', message)
else: else:
await self.send('🤔 No existía ningún aviso de ofertas de BTC configurado.', message) await self.send('🤔 No existía ningún aviso de ofertas BTC configurado.', message)
# -------------------------------------------------------- # # -------------------------------------------------------- #
# -------------------- PUBLIC METHODS -------------------- # # -------------------- PUBLIC METHODS -------------------- #
@@ -276,8 +275,7 @@ class BtcOffersBot(MultiBot, ABC):
chat.save() chat.save()
await self._websocket.send(json.dumps({'action': 'start', 'chat_id': chat.id, 'query': query})) await self._websocket.send(json.dumps({'action': 'start', 'chat_id': chat.id, 'query': query}))
async def start_saved_btc_offers_notification(self): async def start_saved_btc_offers_notifications(self):
for chat in self.Chat.find({
if chats := self.Chat.find({ if chats := self.Chat.find({
'platform': self.platform.value, 'platform': self.platform.value,
'btc_offers_query': {'$exists': True, '$ne': {}} 'btc_offers_query': {'$exists': True, '$ne': {}}