From fb6f3d34629f943fe6f9d783ca39ae4f4544aab8 Mon Sep 17 00:00:00 2001 From: rking32 Date: Tue, 14 Jul 2020 22:10:19 +0530 Subject: [PATCH] small fix in notes and ids --- userge/plugins/tools/ids.py | 17 ++++++++++++++--- userge/plugins/utils/notes.py | 5 ++++- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/userge/plugins/tools/ids.py b/userge/plugins/tools/ids.py index b1ef78772..e9701ed01 100644 --- a/userge/plugins/tools/ids.py +++ b/userge/plugins/tools/ids.py @@ -13,26 +13,37 @@ 'header': "display ids", 'usage': "reply {tr}ids any message, file or just send this command"}) async def getids(message: Message): - out_str = f"šŸ’ Current Chat ID: `{message.chat.id}`" + out_str = f"šŸ‘„ **Chat ID** : `{message.chat.id}`\nšŸ’¬ **Message ID** : `{message.message_id}`" if message.reply_to_message: if message.reply_to_message.from_user: - out_str += f"\nšŸ™‹ā€ā™‚ļø From User ID: `{message.reply_to_message.from_user.id}`" + out_str += f"\nšŸ™‹ā€ā™‚ļø **From User ID** : `{message.reply_to_message.from_user.id}`" file_id = None + type_ = None if message.reply_to_message.media: if message.reply_to_message.audio: + type_ = "audio" file_id = message.reply_to_message.audio.file_id + elif message.reply_to_message.animation: + type_ = "animation" + file_id = message.reply_to_message.animation.file_id elif message.reply_to_message.document: + type_ = "document" file_id = message.reply_to_message.document.file_id elif message.reply_to_message.photo: + type_ = "photo" file_id = message.reply_to_message.photo.file_id elif message.reply_to_message.sticker: + type_ = "sticker" file_id = message.reply_to_message.sticker.file_id elif message.reply_to_message.voice: + type_ = "voice" file_id = message.reply_to_message.voice.file_id elif message.reply_to_message.video_note: + type_ = "video_note" file_id = message.reply_to_message.video_note.file_id elif message.reply_to_message.video: + type_ = "video" file_id = message.reply_to_message.video.file_id if file_id is not None: - out_str += f"\nšŸ“„ File ID: `{file_id}`" + out_str += f"\nšŸ“„ **File ID** (`{type_}`): `{file_id}`" await message.edit(out_str) diff --git a/userge/plugins/utils/notes.py b/userge/plugins/utils/notes.py index 59499a761..9b12f67fa 100644 --- a/userge/plugins/utils/notes.py +++ b/userge/plugins/utils/notes.py @@ -180,14 +180,17 @@ async def get_note(message: Message) -> None: mid, is_global = NOTES_DATA[message.chat.id][notename] if can_access or is_global: replied = message.reply_to_message + user_id = message.from_user.id if replied: reply_to_message_id = replied.message_id + if replied.from_user: + user_id = replied.from_user.id else: reply_to_message_id = message.message_id await CHANNEL.forward_stored(client=message.client, message_id=mid, chat_id=message.chat.id, - user_id=message.from_user.id, + user_id=user_id, reply_to_message_id=reply_to_message_id)