|
@@ -27,7 +27,6 @@ from pyrogram import filters
|
|
|
from pyrogram.types import Message
|
|
from pyrogram.types import Message
|
|
|
|
|
|
|
|
from wbb import SUDOERS, app
|
|
from wbb import SUDOERS, app
|
|
|
-from wbb.core.decorators.errors import capture_err
|
|
|
|
|
from wbb.core.sections import section
|
|
from wbb.core.sections import section
|
|
|
from wbb.utils.dbfunctions import is_gbanned_user, user_global_karma
|
|
from wbb.utils.dbfunctions import is_gbanned_user, user_global_karma
|
|
|
|
|
|
|
@@ -72,7 +71,7 @@ async def get_chat_info(chat, already=False):
|
|
|
chat_id = chat.id
|
|
chat_id = chat.id
|
|
|
username = chat.username
|
|
username = chat.username
|
|
|
title = chat.title
|
|
title = chat.title
|
|
|
- type = chat.type
|
|
|
|
|
|
|
+ type_ = chat.type
|
|
|
is_scam = chat.is_scam
|
|
is_scam = chat.is_scam
|
|
|
description = chat.description
|
|
description = chat.description
|
|
|
members = chat.members_count
|
|
members = chat.members_count
|
|
@@ -83,7 +82,7 @@ async def get_chat_info(chat, already=False):
|
|
|
body = {
|
|
body = {
|
|
|
"ID": chat_id,
|
|
"ID": chat_id,
|
|
|
"DC": dc_id,
|
|
"DC": dc_id,
|
|
|
- "Type": type,
|
|
|
|
|
|
|
+ "Type": type_,
|
|
|
"Name": [title],
|
|
"Name": [title],
|
|
|
"Username": [("@" + username) if username else None],
|
|
"Username": [("@" + username) if username else None],
|
|
|
"Mention": [link],
|
|
"Mention": [link],
|
|
@@ -97,7 +96,6 @@ async def get_chat_info(chat, already=False):
|
|
|
|
|
|
|
|
|
|
|
|
|
@app.on_message(filters.command("info"))
|
|
@app.on_message(filters.command("info"))
|
|
|
-@capture_err
|
|
|
|
|
async def info_func(_, message: Message):
|
|
async def info_func(_, message: Message):
|
|
|
if message.reply_to_message:
|
|
if message.reply_to_message:
|
|
|
user = message.reply_to_message.from_user.id
|
|
user = message.reply_to_message.from_user.id
|
|
@@ -105,16 +103,20 @@ async def info_func(_, message: Message):
|
|
|
user = message.from_user.id
|
|
user = message.from_user.id
|
|
|
elif not message.reply_to_message and len(message.command) != 1:
|
|
elif not message.reply_to_message and len(message.command) != 1:
|
|
|
user = message.text.split(None, 1)[1]
|
|
user = message.text.split(None, 1)[1]
|
|
|
|
|
+
|
|
|
m = await message.reply_text("Processing")
|
|
m = await message.reply_text("Processing")
|
|
|
|
|
+
|
|
|
try:
|
|
try:
|
|
|
info_caption, photo_id = await get_user_info(user)
|
|
info_caption, photo_id = await get_user_info(user)
|
|
|
except Exception as e:
|
|
except Exception as e:
|
|
|
return await m.edit(str(e))
|
|
return await m.edit(str(e))
|
|
|
|
|
+
|
|
|
if not photo_id:
|
|
if not photo_id:
|
|
|
return await m.edit(
|
|
return await m.edit(
|
|
|
info_caption, disable_web_page_preview=True
|
|
info_caption, disable_web_page_preview=True
|
|
|
)
|
|
)
|
|
|
photo = await app.download_media(photo_id)
|
|
photo = await app.download_media(photo_id)
|
|
|
|
|
+
|
|
|
await message.reply_photo(
|
|
await message.reply_photo(
|
|
|
photo, caption=info_caption, quote=False
|
|
photo, caption=info_caption, quote=False
|
|
|
)
|
|
)
|
|
@@ -123,30 +125,32 @@ async def info_func(_, message: Message):
|
|
|
|
|
|
|
|
|
|
|
|
|
@app.on_message(filters.command("chat_info"))
|
|
@app.on_message(filters.command("chat_info"))
|
|
|
-@capture_err
|
|
|
|
|
async def chat_info_func(_, message: Message):
|
|
async def chat_info_func(_, message: Message):
|
|
|
try:
|
|
try:
|
|
|
if len(message.command) > 2:
|
|
if len(message.command) > 2:
|
|
|
return await message.reply_text(
|
|
return await message.reply_text(
|
|
|
"**Usage:**/chat_info [USERNAME|ID]"
|
|
"**Usage:**/chat_info [USERNAME|ID]"
|
|
|
)
|
|
)
|
|
|
- elif len(message.command) == 1:
|
|
|
|
|
|
|
+
|
|
|
|
|
+ if len(message.command) == 1:
|
|
|
chat = message.chat.id
|
|
chat = message.chat.id
|
|
|
elif len(message.command) == 2:
|
|
elif len(message.command) == 2:
|
|
|
chat = message.text.split(None, 1)[1]
|
|
chat = message.text.split(None, 1)[1]
|
|
|
|
|
+
|
|
|
m = await message.reply_text("Processing")
|
|
m = await message.reply_text("Processing")
|
|
|
|
|
+
|
|
|
info_caption, photo_id = await get_chat_info(chat)
|
|
info_caption, photo_id = await get_chat_info(chat)
|
|
|
if not photo_id:
|
|
if not photo_id:
|
|
|
return await m.edit(
|
|
return await m.edit(
|
|
|
info_caption, disable_web_page_preview=True
|
|
info_caption, disable_web_page_preview=True
|
|
|
)
|
|
)
|
|
|
|
|
+
|
|
|
photo = await app.download_media(photo_id)
|
|
photo = await app.download_media(photo_id)
|
|
|
await message.reply_photo(
|
|
await message.reply_photo(
|
|
|
photo, caption=info_caption, quote=False
|
|
photo, caption=info_caption, quote=False
|
|
|
)
|
|
)
|
|
|
|
|
+
|
|
|
await m.delete()
|
|
await m.delete()
|
|
|
os.remove(photo)
|
|
os.remove(photo)
|
|
|
except Exception as e:
|
|
except Exception as e:
|
|
|
- await message.reply_text(e)
|
|
|
|
|
- print(e)
|
|
|
|
|
- await m.delete()
|
|
|
|
|
|
|
+ await m.edit(e)
|