Skip to content

Bad Request: chat not found #308

Open
@usadev1984

Description

@usadev1984

based on the documentation, my bot should be able to respond to a message without specifying the chat id if the message is in the same chat. however when i try something like the following code to respond to a message a user sent to the bot directly in dm:

const char * reply = "You're already in the chat.";
TgBot::ReplyParameters rp_params;
rp_params.allowSendingWithoutReply = true;
rp_params.messageId = ev->messageId;

bot->getApi().sendMessage(ev->chat->id, reply, nullptr, std::make_shared<TgBot::ReplyParameters>(rp_params));

i get Bad Request: chat not found. the only way around it is to provide the chat id. so for example the following works:

const char * reply = "You're already in the chat.";
TgBot::ReplyParameters rp_params;
rp_params.allowSendingWithoutReply = true;
rp_params.messageId = ev->messageId;
rp_params.chatId = ev->chat->id;

bot->getApi().sendMessage(ev->chat->id, reply, nullptr, std::make_shared<TgBot::ReplyParameters>(rp_params));

am i doing something wrong? im using the latest version of the library btw.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions