telegram-apiwtelegramclient

Via Client.Update how to find out that I sent a message?


Tell me how I can understand what is in the handler Client.Update. Is the message coming from me? For some reason, it happens that I look at the From_id and From.Id, there is my ID, then for some reason, there is not.

As I understand it, it shows my ID when I write in a chat, and if in private messages with a friend, it shows his ID.

I'm trying to catch the ID through a common example.

private static void DisplayMessage(MessageBase messageBase, bool edit = false)
{
  if (edit) Console.Write("(Edit): ");

  switch (messageBase)
  {
    case Message m: Console.WriteLine($"{Peer(m.from_id) ?? m.post_author} in {Peer(m.peer_id)}> {m.message}"); break;
    case MessageService ms: Console.WriteLine($"{Peer(ms.from_id)} in {Peer(ms.peer_id)} [{ms.action.GetType().Name[13..]}]"); break;
  }
}

Solution

  • The message.flags should contain the flag Flags.out_ for your outgoing messages.