skip to Main Content

I am using this telegram C# library .I am able to send the messages but Couldn’t find a way how to receive messages in this library. Please assist me.

Thanks in advance.

3

Answers


  1. It looks like that library only supports some functionality, receiving is probably not supported as it isn’t mentioned in the documentation and there is no test for it.

    Login or Signup to reply.
  2. I am not sure about this api you have mentioned, but if receiving messages is not supported in that one, I suggest using this one

    I been using it since almost 1 year ago, I made a Fun bot for my university group where people can teach the bot what to answer to certain messages it receives.
    The usage is pretty simple and it have an example you can learn from.

    You can also check my bot here and see its functionality.

    Login or Signup to reply.
  3. I have this functionality(and many other) implemented in my fork

    You need to create TelegramClient instance, subscribe to UpdateMessage event and call Start method.

    var client = new TelegramClient(null/*sessionStore*/, apiId, apiHash);
    client.UpdateMessage += (sender, updates) =>
    {
          switch (updates.constructor)
          {
              case Constructor.UpdatesTooLong: { break; }
              case Constructor.UpdateShortMessage: { break; }
              case Constructor.UpdateShortChatMessage: { break; }
              case Constructor.UpdateShort: { break; }
              case Constructor.UpdatesCombined: { break; }
              case Constructor.Updates: { break; }
          }
    };
    await client.Start();
    

    For list of possible Update object constructors see this

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search