1111 InputMediaVideo ,
1212 InputMediaDocument ,
1313 InputMediaPhoto ,
14- ReplyParameters ,
1514)
1615from aiofiles .os import (
1716 remove ,
@@ -122,6 +121,8 @@ async def _msg_to_reply(self):
122121 except Exception as e :
123122 await self ._listener .on_upload_error (str (e ))
124123 return False
124+ finally :
125+ self ._base_msg = self ._sent_msg
125126 elif self ._user_session :
126127 self ._sent_msg = await TgClient .user .get_messages (
127128 chat_id = self ._listener .message .chat .id , message_ids = self ._listener .mid
@@ -134,7 +135,6 @@ async def _msg_to_reply(self):
134135 )
135136 else :
136137 self ._sent_msg = self ._listener .message
137- self ._base_msg = self ._sent_msg
138138 return True
139139
140140 async def _prepare_file (self , file_ , dirpath ):
@@ -223,26 +223,6 @@ async def _send_media_group(self, subkey, key, msgs):
223223 if self ._base_msg :
224224 await delete_message (self ._base_msg )
225225 self ._base_msg = None
226- """for ch, ch_data in list(self._listener.clone_dump_chats.items()):
227- if ch_data["last_sent_msg"]:
228- reply_param = ReplyParameters(message_id=ch_data["last_sent_msg"])
229- else:
230- reply_param = None
231- try:
232- res = await TgClient.bot.forward_media_group(
233- ch,
234- self._sent_msg.chat.id,
235- self._sent_msg.id,
236- ch_data["thread_id"],
237- True,
238- hide_sender_name=True,
239- reply_parameters=reply_param,
240- )
241- self._listener.clone_dump_chats[ch]["last_sent_msg"] = res[-1].id
242- except Exception as e:
243- LOGGER.error(
244- f"Can't forward message to clone dump chat: {ch}. Error: {e}"
245- )"""
246226
247227 async def upload (self ):
248228 await self ._user_settings ()
@@ -305,21 +285,14 @@ async def upload(self):
305285 for ch , ch_data in list (
306286 self ._listener .clone_dump_chats .items ()
307287 ):
308- if ch_data ["last_sent_msg" ]:
309- reply_param = ReplyParameters (
310- message_id = ch_data ["last_sent_msg" ]
311- )
312- else :
313- reply_param = None
314288 try :
315- res = await TgClient .bot .forward_messages (
316- ch ,
317- self ._sent_msg .chat .id ,
318- self ._sent_msg .id ,
319- ch_data ["thread_id" ],
320- True ,
321- hide_sender_name = True ,
322- reply_parameters = reply_param ,
289+ res = await TgClient .bot .copy_message (
290+ chat_id = ch ,
291+ from_chat_id = self ._sent_msg .chat .id ,
292+ message_id = self ._sent_msg .id ,
293+ message_thread_id = ch_data ["thread_id" ],
294+ disable_notification = True ,
295+ reply_to_message_id = ch_data ["last_sent_msg" ],
323296 )
324297 self ._listener .clone_dump_chats [ch ][
325298 "last_sent_msg"
0 commit comments