-
Notifications
You must be signed in to change notification settings - Fork 378
How to listen new message / use handle update? #580
Comments
If you need to catch new message from user or group after authorizing, you can check status in simple loop without getting FLOOD_EXCEPTION. But this not working with channels.
|
In general you need to create test channel, test group and second user and check whats happends with this code pattern (or try to use PUSH notification https://core.telegram.org/api/push-updates with TeleSharp.TL.Account.TLRequestRegisterDevice). General testing pattern:
|
Finnaly I use this code for reading my channels and mark message as read
|
why my code doesn't work ? @mirror-neuron |
so "upd.message as TLMessage).message" get you the message but how would u get a photo in the message or know what channel the message came from? |
munrocket thats nothing to do with the question i asked sir. |
while (true)
} thanks |
Someone Please give me an example how to use TLRequestRegisterDevice. I try to use something like this.
Thanks. |
Hello I have tried this code so many times.
And I found that diff will be returned "TLDifferenceEmpty" always. |
Does anyone know why why compiler cant find "lists"? I am trying read last message |
try to use .ToList() instead |
@pisitch I have same problem. Anyone resolve it? |
Ok I'm getting a few grey hairs now.. I am wanting to forward messages between groups. User sets up which group forwards to whom. so select from group from drop down, and select to group. then config that from that point going forward all new messages are automatically forwarded from the one group to the other.. I am able to get the user to select To and From group and forward the last message sent to the from group gets forwarded to the To group with this code
But now I am at the point where I want to forward any new messages received on the from group to that To group as well.
not sure how to hook this up to listen for new messages on a particular group to forward. |
As i know sending message much easier than listen updates. Try with sipmle message and another user at first. |
Hello please i would like to know where to paste this code, how do I implement in a way that it always listens for a new message. |
@munrocket I want just simply track incoming messages from certain user. Why using this peace of code in while loop i miss approximately 5/6 of incoming messages? where are the rest? |
@Trinitron just use telethon and relax, TLSharp has an annoying verbouse api. |
If someone still uses this library and struggling between unobvious exceptions here is my small example how to listen incomming telegram messages:
|
I always receive TLDifferenceEmpty, do you know why? |
state.Pts-state.UnreadCount - it's solve |
ModernTLSharp solve this problem |
Also this PR: #940 can anyone test it please? |
According to #361 #43 right way to get new messages is TLRequestGetDifference or HandleUpdate usage. Also we can find official manual about processing updates: https://core.telegram.org/api/updates
Here we need an source code example. Same questions: #564 #239 #436 #457 #524 #538 #547 #570
The text was updated successfully, but these errors were encountered: