Skip to content

Commit

Permalink
fix - telegram sender infinity loop
Browse files Browse the repository at this point in the history
  • Loading branch information
jjpaulo2 committed Oct 2, 2024
1 parent 232e067 commit 0204d4b
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions function/telegram/sender.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ async def _send_message(self, message: TelegramMessage):
for index, token in enumerate(self.tokens):
try:
client = await self.client(token)
await client.send_message(
return await client.send_message(
chat_id=message.chat_id,
text=message.content,
reply_markup=message.buttons,
Expand All @@ -62,7 +62,7 @@ async def _send_image(self, message: TelegramMessage):
client = await self.client(token)

try:
await client.send_photo(
return await client.send_photo(
chat_id=message.chat_id,
photo=message.image, # type: ignore
caption=message.content,
Expand All @@ -83,7 +83,7 @@ async def _send_album(self, message: TelegramMessage):
for index, token in enumerate(self.tokens):
try:
client = await self.client(token)
await client.send_media_group(
return await client.send_media_group(
chat_id=message.chat_id,
media=message.album, # type: ignore
disable_notification=True,
Expand All @@ -99,9 +99,9 @@ async def send(self, message: TelegramMessage):
if message.album:
await self._send_album(message)
if message.image:
await self._send_image(message)
return await self._send_image(message)
else:
await self._send_message(message)
return await self._send_message(message)

except FloodWait as exc:
raise exc
Expand Down

0 comments on commit 0204d4b

Please sign in to comment.