Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from telegram import Bot, ReplyMarkup, MessageId
- TOKEN =
- CHAT_ID =
- MESSAGE_ID =
- bot = Bot(TOKEN)
- r = bot.copy_message(chat_id=CHAT_ID, from_chat_id=CHAT_ID, message_id=MESSAGE_ID, caption="")
- bot.send_message(chat_id=CHAT_ID, text="Without changes ^", reply_to_message_id=r.message_id)
- class newBot(Bot):
- def copy_message(self, chat_id, from_chat_id, message_id, caption=None, parse_mode=None,caption_entities=None,
- disable_notification=None, reply_to_message_id=None, allow_sending_without_reply=None,
- reply_markup=None, timeout=None, api_kwargs=None):
- data = {
- 'chat_id': chat_id,
- 'from_chat_id': from_chat_id,
- 'message_id': message_id,
- 'parse_mode': parse_mode,
- 'disable_notification': disable_notification,
- 'allow_sending_without_reply': allow_sending_without_reply,
- }
- if caption is not None:
- data['caption'] = caption
- if caption_entities:
- data['caption_entities'] = caption_entities
- if reply_to_message_id:
- data['reply_to_message_id'] = reply_to_message_id
- if reply_markup:
- if isinstance(reply_markup, ReplyMarkup):
- data['reply_markup'] = reply_markup.to_json()
- else:
- data['reply_markup'] = reply_markup
- result = self._post('copyMessage', data, timeout=timeout, api_kwargs=api_kwargs)
- return MessageId.de_json(result, self)
- bot = newBot(TOKEN)
- r = bot.copy_message(chat_id=CHAT_ID, from_chat_id=CHAT_ID, message_id=MESSAGE_ID, caption="")
- bot.send_message(chat_id=CHAT_ID, text="With changes ^", reply_to_message_id=r.message_id)
Advertisement
Add Comment
Please, Sign In to add comment