Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

telegram bot can't send messages to super group

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

like image 980
syaneteu Avatar asked Dec 11 '22 05:12

syaneteu


1 Answers

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

like image 82
piyushkantm Avatar answered Dec 20 '22 11:12

piyushkantm