Skip to content

Commit

Permalink
small fix in notes and ids
Browse files Browse the repository at this point in the history
  • Loading branch information
rking32 committed Jul 14, 2020
1 parent 1a28bff commit fb6f3d3
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
17 changes: 14 additions & 3 deletions userge/plugins/tools/ids.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
5 changes: 4 additions & 1 deletion userge/plugins/utils/notes.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)


Expand Down

0 comments on commit fb6f3d3

Please sign in to comment.