|
|
@@ -28,6 +28,7 @@ from pyrogram.types import Message
|
|
|
|
|
|
from wbb import SUDOERS, app
|
|
|
from wbb.core.decorators.errors import capture_err
|
|
|
+from wbb.modules.trust import get_spam_probability
|
|
|
from wbb.utils.dbfunctions import is_gbanned_user, user_global_karma
|
|
|
|
|
|
__MODULE__ = "Info"
|
|
|
@@ -45,22 +46,28 @@ async def get_user_info(user):
|
|
|
username = user.username
|
|
|
first_name = user.first_name
|
|
|
mention = user.mention("Link")
|
|
|
- status = user.status
|
|
|
dc_id = user.dc_id
|
|
|
photo_id = user.photo.big_file_id if user.photo else None
|
|
|
is_gbanned = await is_gbanned_user(user_id)
|
|
|
is_sudo = user_id in SUDOERS
|
|
|
karma = await user_global_karma(user_id)
|
|
|
+ spam_probab, n_messages = await get_spam_probability(user_id)
|
|
|
+ isSpammer = True if spam_probab > 70 else False if spam_probab != 0 else "Uncertain"
|
|
|
+ isPotentialSpammer = True if spam_probab > 40 else False if spam_probab != 0 else "Uncertain"
|
|
|
+ spam_probab = str(round(spam_probab)) + " %" if spam_probab != 0 else "Uncertain"
|
|
|
caption = f"""
|
|
|
**ID:** `{user_id}`
|
|
|
**DC:** {dc_id}
|
|
|
**Name:** {first_name}
|
|
|
**Username:** {("@" + username) if username else None}
|
|
|
-**Permalink:** {mention}
|
|
|
-**Status:** {status}
|
|
|
+**Mention:** {mention}
|
|
|
**Sudo:** {is_sudo}
|
|
|
**Karma:** {karma}
|
|
|
**Gbanned:** {is_gbanned}
|
|
|
+**ARQ Spam Detection:**
|
|
|
+ **Spammer:** {isSpammer}
|
|
|
+ **Spam Probability:** {spam_probab}
|
|
|
+ __Stats Of Last {n_messages} Messages.__
|
|
|
"""
|
|
|
return [caption, photo_id]
|
|
|
|
|
|
@@ -84,7 +91,7 @@ async def get_chat_info(chat):
|
|
|
**Type:** {type}
|
|
|
**Name:** {title}
|
|
|
**Username:** {("@" + username) if username else None}
|
|
|
-**Permalink:** {link}
|
|
|
+**Mention:** {link}
|
|
|
**Members:** {members}
|
|
|
**Scam:** {is_scam}
|
|
|
**Restricted:** {is_restricted}
|
|
|
@@ -96,24 +103,20 @@ async def get_chat_info(chat):
|
|
|
@app.on_message(filters.command("info"))
|
|
|
@capture_err
|
|
|
async def info_func(_, message: Message):
|
|
|
- try:
|
|
|
- if message.reply_to_message:
|
|
|
- user = message.reply_to_message.from_user.id
|
|
|
- elif not message.reply_to_message and len(message.command) == 1:
|
|
|
- user = message.from_user.id
|
|
|
- elif not message.reply_to_message and len(message.command) != 1:
|
|
|
- user = message.text.split(None, 1)[1]
|
|
|
- m = await message.reply_text("Processing")
|
|
|
- info_caption, photo_id = await get_user_info(user)
|
|
|
- if not photo_id:
|
|
|
- return await m.edit(info_caption, disable_web_page_preview=True)
|
|
|
- photo = await app.download_media(photo_id)
|
|
|
- await message.reply_photo(photo, caption=info_caption, quote=False)
|
|
|
- await m.delete()
|
|
|
- os.remove(photo)
|
|
|
- except Exception as e:
|
|
|
- await message.reply_text(str(e))
|
|
|
- print(e)
|
|
|
+ if message.reply_to_message:
|
|
|
+ user = message.reply_to_message.from_user.id
|
|
|
+ elif not message.reply_to_message and len(message.command) == 1:
|
|
|
+ user = message.from_user.id
|
|
|
+ elif not message.reply_to_message and len(message.command) != 1:
|
|
|
+ user = message.text.split(None, 1)[1]
|
|
|
+ m = await message.reply_text("Processing")
|
|
|
+ info_caption, photo_id = await get_user_info(user)
|
|
|
+ if not photo_id:
|
|
|
+ return await m.edit(info_caption, disable_web_page_preview=True)
|
|
|
+ photo = await app.download_media(photo_id)
|
|
|
+ await message.reply_photo(photo, caption=info_caption, quote=False)
|
|
|
+ await m.delete()
|
|
|
+ os.remove(photo)
|
|
|
|
|
|
|
|
|
@app.on_message(filters.command("chat_info"))
|
|
|
@@ -139,3 +142,4 @@ async def chat_info_func(_, message: Message):
|
|
|
except Exception as e:
|
|
|
await message.reply_text(e)
|
|
|
print(e)
|
|
|
+ await m.delete()
|