forked from TeamUltroid/UltroidAddons
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtotalmsgs.py
More file actions
29 lines (22 loc) · 716 Bytes
/
totalmsgs.py
File metadata and controls
29 lines (22 loc) · 716 Bytes
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
# credit https://t.me/I_m_FlaSh
"""
✘ Commands Available -
• `{i}totalmsgs`
Returns your total msg count in current chat
• `{i}totalmsgs [username]/<reply>`
Returns total msg count of user in current chat
"""
from . import *
from telethon.utils import get_display_name
@ultroid_cmd(pattern="totalmsgs ?(.*)")
async def _(e):
match = e.pattern_match.group(1)
if match:
user = match
elif e.is_reply:
user = (await e.get_reply_message()).sender_id
else:
user = "me"
a = await e.client.get_messages(e.chat_id, 0, from_user=user)
user = await e.client.get_entity(user)
await eor(e, f"Total msgs of `{get_display_name(user)}` here = {a.total}")