wiz0u / WTelegramClient

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

Monitor chat updates where i am not a member (not joined this chat) #219

Closed allserialtv closed 11 months ago

allserialtv commented 12 months ago

Hello.

Is there a way to subscribe to chat updates in my userbot is not a member of this chat. Basically i need to monitor updates of chats where I am not a member of.

Php madelineproto has such option, may be your lib also could provide it

wiz0u commented 12 months ago

if you point me to info on how you do this with madelineproto, maybe I can help

wiz0u commented 12 months ago

note also that your question seems more about the use of Telegram API, not a problem with WTelegramClient library code.

github-actions[bot] commented 11 months ago

Github Issues should be used only for problems with the library itself. For questions about Telegram API usage, you can search the API official documentation or click here to ask your question on StackOverflow so the whole community can help and benefit.

wiz0u commented 11 months ago

Ok I've looked into it. It's a bit high-level feature offered by TDLib openChat. Basically the way to do this with Client API is something like:

var channel = (await Client.Contacts_ResolveUsername("somechannel")).Channel;
var channelFull = (await Client.GetFullChat(channel)).full_chat as ChannelFull; // fetch current pts
var diff = await Client.Updates_GetChannelDifference(channel, null, channelFull.pts, 0); // "open" the chat
// now you start receiving updates temporarily about this supergroup/channel
// ... you must renew Updates_GetChannelDifference call after diff.Timeout seconds