Paste #179273 |
pasted on 04.05.2021 14:20
- Edit to this paste
- Raw
- The following pastes replied to this paste: # 260732
- Show paste tree
-
Compare with paste
#
Text paste
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | def painttest(update, context): def outtext(text): if edt_msg: try: msg = context.bot.edit_message_text(chat_id = update.edited_message.chat.id, message_id = replys[update.edited_message.chat.id],text=text) except telegram.error.BadRequest: context.bot.delete_message(chat_id = update.edited_message.chat.id, message_id = replys[update.edited_message.chat.id]) msg = update.edited_message.reply_text(text) return msg else: return update.message.reply_text(text) def outphoto(filename): fn = os.path.basename(filename.rstrip(os.sep)) if edt_msg: try: msg = context.bot.edit_message_media(chat_id=update.edited_message.chat.id,message_id=replys[update.edited_message.chat.id],media=telegram.InputMediaPhoto(filename=fn,media=open(filename, 'rb'))) except telegram.error.BadRequest: context.bot.delete_message(chat_id = update.edited_message.chat.id, message_id = replys[update.edited_message.chat.id]) msg = update.edited_message.reply_photo(filename=fn,photo=open(filename, 'rb')) return msg else: return update.message.reply_photo(filename=fn,photo=open(filename, 'rb')) try: text = update.message.text edt_msg = False except AttributeError: text = update.edited_message.text edt_msg = True |