vysheng / tg

telegram-cli
GNU General Public License v2.0
6.51k stars 1.54k forks source link

fwd_msg won't forward if the message was sent before the job was opened #611

Open lucasberti opened 9 years ago

lucasberti commented 9 years ago

Hello. I don't know if the title was clear enough, so I'll just give an example:

• Receive a message (ex: ID 123456). • Forward it via Terminal and via Lua (using fwd_msg(receiver_id, 123456, ok_cb, false)) and it works both ways. • Close Telegram and reopen it. • Forward it via Terminal, it works. • Forward it via Lua, the message can't be forwarded.

luckydonald commented 9 years ago

Maybe you have to load that again. I here was a method to get a message by its number. Try doing that first. Does that work?

lucasberti commented 9 years ago

I don't know about that method. I have a bunch of message IDs in a table, and when my bot receives a certain keyword, it looks up a random message ID in that table and uses fwd_msg. I don't know what else I could/need to do.

erfan-mehraban commented 9 years ago

It will work if you received info about that peer. #634

lucasberti commented 9 years ago

@erfan-mehraban, the messages that I have stored were sent in a group chat, and I'm trying to forward it to the same chat. Here is the code (based on @yagop's telegram-bot). I don't quite understand about "receiving info from the peer". Do you mean I should use chat_info or user_info?

sargashteh commented 7 years ago

i can't use peer.fwd_msg() in python script .... tg-cli crashed and get error how can fix and use it ???