10
10
"""Type `.count` and see Magic."""
11
11
12
12
@borg .on (slitu .admin_cmd (pattern = 'count' ))
13
- async def stats (event : NewMessage .Event ) -> None : # pylint: disable = R0912, R0914, R0915
13
+ async def stats (event : NewMessage .Event ) -> None : # pylint: disable = R0912, R0914, R0915
14
14
"""Command to get stats about the account"""
15
15
waiting_message = await event .edit ('`Collecting stats, Wait Nibba`' )
16
16
start_time = time .time ()
@@ -30,38 +30,35 @@ async def stats(event: NewMessage.Event) -> None: # pylint: disable = R0912, R0
30
30
async for dialog in event .client .iter_dialogs ():
31
31
entity = dialog .entity
32
32
33
- if isinstance (entity , Channel ):
34
- # participants_count = (await event.get_participants(dialog, limit=0)).total
35
- if entity .broadcast :
36
- broadcast_channels += 1
37
- if entity .creator or entity .admin_rights :
38
- admin_in_broadcast_channels += 1
39
- if entity .creator :
40
- creator_in_channels += 1
41
-
42
- elif entity .megagroup :
43
- groups += 1
44
- # if participants_count > largest_group_member_count:
45
- # largest_group_member_count = participants_count
46
- if entity .creator or entity .admin_rights :
47
- # if participants_count > largest_group_with_admin:
48
- # largest_group_with_admin = participants_count
49
- admin_in_groups += 1
50
- if entity .creator :
51
- creator_in_groups += 1
52
-
53
- elif isinstance (entity , User ):
54
- private_chats += 1
55
- if entity .bot :
56
- bots += 1
57
-
58
- elif isinstance (entity , Chat ):
33
+ if isinstance (entity , Channel ) and entity .broadcast :
34
+ broadcast_channels += 1
35
+ if entity .creator or entity .admin_rights :
36
+ admin_in_broadcast_channels += 1
37
+ if entity .creator :
38
+ creator_in_channels += 1
39
+
40
+ elif (
41
+ isinstance (entity , Channel )
42
+ and entity .megagroup
43
+ or not isinstance (entity , Channel )
44
+ and not isinstance (entity , User )
45
+ and isinstance (entity , Chat )
46
+ ):
59
47
groups += 1
48
+ # if participants_count > largest_group_member_count:
49
+ # largest_group_member_count = participants_count
60
50
if entity .creator or entity .admin_rights :
51
+ # if participants_count > largest_group_with_admin:
52
+ # largest_group_with_admin = participants_count
61
53
admin_in_groups += 1
62
54
if entity .creator :
63
55
creator_in_groups += 1
64
56
57
+ elif not isinstance (entity , Channel ) and isinstance (entity , User ):
58
+ private_chats += 1
59
+ if entity .bot :
60
+ bots += 1
61
+
65
62
unread_mentions += dialog .unread_mentions_count
66
63
unread += dialog .unread_count
67
64
stop_time = time .time () - start_time
0 commit comments