Spaces:
Paused
Paused
iamgojoof6eyes
commited on
Commit
Β·
62d9953
1
Parent(s):
5341b2a
Looks good
Browse files- Powers/plugins/info.py +22 -1
Powers/plugins/info.py
CHANGED
|
@@ -3,6 +3,7 @@ from traceback import format_exc
|
|
| 3 |
from datetime import datetime
|
| 4 |
|
| 5 |
from pyrogram.types import Message
|
|
|
|
| 6 |
|
| 7 |
from Powers import DEV_USERS, SUDO_USERS, WHITELIST_USERS, SUPPORT_STAFF, LOGGER
|
| 8 |
from Powers.bot_class import Gojo
|
|
@@ -14,7 +15,21 @@ from Powers.utils.chat_type import c_type
|
|
| 14 |
|
| 15 |
gban_db=GBan()
|
| 16 |
|
| 17 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
|
| 19 |
async def user_info(c: Gojo, user, already=False):
|
| 20 |
if not already:
|
|
@@ -108,8 +123,10 @@ async def user_info(c: Gojo, user, already=False):
|
|
| 108 |
async def chat_info(c: Gojo, chat, already=False):
|
| 109 |
if not already:
|
| 110 |
chat = await c.get_chat(chat)
|
|
|
|
| 111 |
chat_id = chat.id
|
| 112 |
username = chat.username
|
|
|
|
| 113 |
title = chat.title
|
| 114 |
type_ = c_type(c, chat_id=chat)
|
| 115 |
is_scam = chat.is_scam
|
|
@@ -137,6 +154,10 @@ async def chat_info(c: Gojo, chat, already=False):
|
|
| 137 |
<b>β¨ Chat Type</b>: {type_}
|
| 138 |
<b>π DataCentre ID</b>: {dc_id}
|
| 139 |
<b>π Username</b>: {("@" + username) if username else "NA"}
|
|
|
|
|
|
|
|
|
|
|
|
|
| 140 |
<b>π§ Scam</b>: {is_scam}
|
| 141 |
<b>π€¨ Fake</b>: {is_fake}
|
| 142 |
<b>π§ Restricted</b>: {is_restricted}
|
|
|
|
| 3 |
from datetime import datetime
|
| 4 |
|
| 5 |
from pyrogram.types import Message
|
| 6 |
+
from pyrogram import enums
|
| 7 |
|
| 8 |
from Powers import DEV_USERS, SUDO_USERS, WHITELIST_USERS, SUPPORT_STAFF, LOGGER
|
| 9 |
from Powers.bot_class import Gojo
|
|
|
|
| 15 |
|
| 16 |
gban_db=GBan()
|
| 17 |
|
| 18 |
+
async def admin_bot_count(c: Gojo, chat):
|
| 19 |
+
administrator = []
|
| 20 |
+
async for admin in c.get_chat_members(chat_id=chat, filter = enums.ChatMembersFilter.ADMINISTRATORS):
|
| 21 |
+
total_admin = administrator.append(admin)
|
| 22 |
+
bot = []
|
| 23 |
+
async for tbot in c.get_chat_members(chat_id=chat, filter= enums.ChatMembersFilter.BOTS):
|
| 24 |
+
total_bot = bot.append(tbot)
|
| 25 |
+
bot_admin = 0
|
| 26 |
+
for x in total_admin:
|
| 27 |
+
for y in total_bot:
|
| 28 |
+
if x == y:
|
| 29 |
+
bot_admin += 1
|
| 30 |
+
total_admin = len(total_admin)
|
| 31 |
+
total_bot = len(total_bot)
|
| 32 |
+
return total_bot, total_admin, bot_admin
|
| 33 |
|
| 34 |
async def user_info(c: Gojo, user, already=False):
|
| 35 |
if not already:
|
|
|
|
| 123 |
async def chat_info(c: Gojo, chat, already=False):
|
| 124 |
if not already:
|
| 125 |
chat = await c.get_chat(chat)
|
| 126 |
+
online_mem = c.get_chat_online_count(chat)
|
| 127 |
chat_id = chat.id
|
| 128 |
username = chat.username
|
| 129 |
+
total_bot, total_admin, total_bot_admin = await admin_bot_count(c,chat)
|
| 130 |
title = chat.title
|
| 131 |
type_ = c_type(c, chat_id=chat)
|
| 132 |
is_scam = chat.is_scam
|
|
|
|
| 154 |
<b>β¨ Chat Type</b>: {type_}
|
| 155 |
<b>π DataCentre ID</b>: {dc_id}
|
| 156 |
<b>π Username</b>: {("@" + username) if username else "NA"}
|
| 157 |
+
<b>βοΈ Administrators</b>: {total_admin}
|
| 158 |
+
<b>π€ Bots</b>: {total_bot}
|
| 159 |
+
<b>βοΈ Admin π€ Bots</b>: {total_bot_admin}
|
| 160 |
+
<b>π¨βπ» Currently online</b>: {online_mem}
|
| 161 |
<b>π§ Scam</b>: {is_scam}
|
| 162 |
<b>π€¨ Fake</b>: {is_fake}
|
| 163 |
<b>π§ Restricted</b>: {is_restricted}
|