Answer the question
In order to leave comments, you need to log in
Telegram bot greeting C#?
I was thinking about how to greet him when a new member enters the group, or rather, to have the bot do it, I’m looking for a similar method, but something doesn’t work out very well.
I thought about watching it through ChatMemberStatus, but I don’t understand how, although there is also the NewChatMembers method, I tried it through it, but it simply answers every message that the user has entered the chat, here is the line of code
if (message.Type == MessageType.Text && message.NewChatMembers != null)
return;
await Bot.SendTextMessageAsync(message.Chat.Id, $"{name}, Привет !");
Console.WriteLine($"{name} Вошел в чат");
Answer the question
In order to leave comments, you need to log in
You are trying to use the wrong message.Type. You need MessageType.ChatMembersAdded - with this value, the NewChatMembers field will contain an array of users who were just added
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question