6

this is my code

private async void Bot_OnMessage(object sender, Telegram.Bot.Args.MessageEventArgs e)
    {

        var message = e.Message; if (message == null || message.Type != MessageType.Text) return; await Bot.SendTextMessageAsync(message.Chat.Id, "Hello?");

in this case, it works well with super groups

but await Bot.SendTextMessageAsync([supergroup chat id], "Hello?");

put Super Group ID in here[supergroup chat id], it won't work. I've set up all the group permissions. After upgrading the super group, I had to drop the bot and invite again

syaneteu
  • 63
  • 1
  • 1
  • 5

2 Answers2

19

Just in case if you are haven't figured it out already... When a group is upgraded to supergroup, new ID is generated:

{
    "ok": false,
    "error_code": 400,
    "description": "Bad Request: group chat was upgraded to a supergroup chat",
    "parameters": {
        "migrate_to_chat_id": -1001432162429
    }
}

Use this migrate_to_chat_id to send messages

piyushkantm
  • 584
  • 5
  • 19
0

If you can't see the above 'migrate_to_chat_id' field mentioned by piyushkantm you can use:

bot.on('message', (msg) => {
    const chatId = msg.chat.id;
    console.log(chatId);
});

When your request fails send a test message to the group via mobile phone the above will return your updated super group chat.id.