forked from lyonipiece/FridayUserbot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstats.py
59 lines (54 loc) · 1.67 KB
/
stats.py
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# Copyright (C) 2020-2021 by DevsExpo@Github, < https://github.com/DevsExpo >.
#
# This file is part of < https://github.com/DevsExpo/FridayUserBot > project,
# and is released under the "GNU v3.0 License Agreement".
# Please see < https://github.com/DevsExpo/blob/master/LICENSE >
#
# All rights reserved.
from datetime import datetime
from main_startup.core.decorators import friday_on_cmd
from main_startup.helper_func.basic_helpers import edit_or_reply, get_text, progress
@friday_on_cmd(
["stats", "stat"],
cmd_help={
"help": "Shows user account stats!",
"example": "{ch}stats",
},
)
async def stats(client, message):
pablo = await edit_or_reply(message, f"`Processing...`")
start = datetime.now()
u = 0
g = 0
sg = 0
c = 0
b = 0
a_chat = 0
group = ["supergroup", "group"]
async for dialog in client.iter_dialogs():
if dialog.chat.type == "private":
u += 1
elif dialog.chat.type == "bot":
b += 1
elif dialog.chat.type == "group":
g += 1
elif dialog.chat.type == "supergroup":
sg += 1
user_s = await dialog.chat.get_member(int(client.me.id))
if user_s.status in ("creator", "administrator"):
a_chat += 1
elif dialog.chat.type == "channel":
c += 1
end = datetime.now()
ms = (end - start).seconds
await pablo.edit(
"""`Your Stats Obtained in {} seconds`
`You have {} Private Messages.`
`You are in {} Groups.`
`You are in {} Super Groups.`
`You Are in {} Channels.`
`You Are Admin in {} Chats.`
`Bots = {}`""".format(
ms, u, g, sg, c, a_chat, b
)
)