Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NewMessageListener - fired multiple times #4462

Open
3 tasks done
rush0815 opened this issue Sep 11, 2024 · 1 comment
Open
3 tasks done

NewMessageListener - fired multiple times #4462

rush0815 opened this issue Sep 11, 2024 · 1 comment

Comments

@rush0815
Copy link

rush0815 commented Sep 11, 2024

Code that causes the issue

´´'from telethon import TelegramClient, events, sync

api_id = "yyyyy"
api_hash = "xxxxxxx"
client = TelegramClient('me', api_id, api_hash)
clientCommander = TelegramClient('commander', api_id, api_hash)

@client.on(events.NewMessage(chats = inputCmdChannel))
async def NewMessageListener(event):
msg = event.message.message

´´´

Expected behavior

I expected, that this function will only be fired once per received new message. So, if the inputCmdChannel has already messages in it and I start the python program, nothing should happen until I send a new message.

Actual behavior

Currently NewMessageListener sometime is fired multiple times and process one or two older messages that are allready in the inputCmdChannel.

Traceback

No response

Telethon version

36.0

Python version

3.10.12

Operating system (including distribution name and version)

Debian 12.2

Other details

No response

Checklist

  • The error is in the library's code, and not in my own.
  • I have searched for this issue before posting it and there isn't an open duplicate.
  • I ran pip install -U https://github.com/LonamiWebs/Telethon/archive/v1.zip and triggered the bug in the latest version.
@takabinance
Copy link

Have a similar issue where same new message is being sent a number of times and then today I just got a flood of messages that were months old. Will add a max id check by channel to try to deal with it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants