atipugin / telegram-bot-ruby

Ruby wrapper for Telegram's Bot API
https://core.telegram.org/bots/api
Do What The F*ck You Want To Public License
1.35k stars 218 forks source link

Forward my message to other users #238

Closed anko20094 closed 2 years ago

anko20094 commented 2 years ago

I try do when bot received my message forward it for other users, but this code doesn't work for me:

bot.api.forward_message(to_chat_id: customer.c_id, from_chat_id: message.chat.id, message_id: message.message_id)

customer.c_id - it takes users ID from DB

and I have that error: Telegram API has returned the error. (ok: "false", error_code: "400", description: "Bad Request: chat_id is empty")

any advice?

ivanovaleksey commented 2 years ago

It looks like the parameter is called chat_id and not to_chat_id. https://core.telegram.org/bots/api#forwardmessage

anko20094 commented 2 years ago

Oo, yes, now it works, thank you very much:)