skip to Main Content

I’ve created a Telegram Bot using C# and I want to see who is using my bot when sending message.
I can get when people send a message to my bot in private chat but in the Groups, I can’t get Username who is using Bot and it’s return the GroupName.

The method I use is

var me = Bot.GetChatAsync(e.Message.Chat.Id).Result;

2

Answers


  1. From doc this field User is optional for groups.

    Login or Signup to reply.
  2. You can see who send message in e.Message.From, this property returns who send it as User.

    And you should await methods that is awaitable.


    And in your case Bot.GetChatAsync, this will return Chat from ChatId.

    It means: Info about chat from Id.

    And you pass Chat not ChatId to Bot.GetChatAsync

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