wiz0u / WTelegramClient

Telegram Client API (MTProto) library written 100% in C# and .NET
https://wiz0u.github.io/WTelegramClient/
MIT License
956 stars 156 forks source link

Example on how to use IPeerCollector #265

Closed mehtadone closed 2 months ago

mehtadone commented 2 months ago

Hi,

Can anyone provide an example of how to use UpdateManager with IPeerCollector? I was under the assumption you could use this to listen to updates from certain chats/users only but if I create one and add chats/users, I still receive messages from all chats.

Thank you in advance

RafayGhafoor commented 2 months ago

@mehtadone, You can see example here where you can handle the case of new message arrived and handle by specific user id or chat.

mehtadone commented 2 months ago

@mehtadone, You can see example here where you can handle the case of new message arrived and handle by specific user id or chat.

Thank you! This is what I am doing now, but was more wondering if you didn't have to handle every message. I thought that is was IPeerCollector does

wiz0u commented 2 months ago

IPeerCollector is not a filtering system, it's a collector system. The HasUser/HasChat are used to determine if a user/chat was already collected.