taslim19
commited on
Commit
·
1122d52
1
Parent(s):
b7445bc
fix: added markdown
Browse files
DragMusic/plugins/plugins/nsfw.py
CHANGED
@@ -11,6 +11,7 @@ from transformers import AutoModelForImageClassification, ViTImageProcessor
|
|
11 |
from DragMusic import app
|
12 |
from motor.motor_asyncio import AsyncIOMotorClient
|
13 |
from config import MONGO_DB_URI
|
|
|
14 |
|
15 |
# MongoDB setup
|
16 |
db_client = AsyncIOMotorClient(MONGO_DB_URI)
|
@@ -50,7 +51,7 @@ async def is_admin(client: Client, chat_id: int, user_id: int) -> bool:
|
|
50 |
@app.on_message(filters.command("nsfw") & filters.group)
|
51 |
async def toggle_nsfw_scan(client: Client, message: Message):
|
52 |
if len(message.command) != 2:
|
53 |
-
return await message.reply("Usage:\n
|
54 |
|
55 |
user_is_admin = await is_admin(client, message.chat.id, message.from_user.id)
|
56 |
if not user_is_admin:
|
@@ -59,12 +60,12 @@ async def toggle_nsfw_scan(client: Client, message: Message):
|
|
59 |
arg = message.command[1].lower()
|
60 |
if arg == "enable":
|
61 |
await enable_nsfw(message.chat.id)
|
62 |
-
await message.reply("✅ NSFW scanning has been
|
63 |
elif arg == "disable":
|
64 |
await disable_nsfw(message.chat.id)
|
65 |
-
await message.reply("🚫 NSFW scanning has been
|
66 |
else:
|
67 |
-
await message.reply("⚠️ Invalid option. Use
|
68 |
|
69 |
# Debug command: /whoami
|
70 |
@app.on_message(filters.command("whoami") & filters.group)
|
@@ -76,10 +77,10 @@ async def whoami(client: Client, message: Message):
|
|
76 |
f"📢 Chat ID: `{message.chat.id}`\n"
|
77 |
f"🛡️ Your status: `{member.status}`",
|
78 |
quote=True,
|
79 |
-
parse_mode=
|
80 |
)
|
81 |
except Exception as e:
|
82 |
-
await message.reply_text(f"❌ Failed to fetch status:
|
83 |
|
84 |
# Command: /scan (manual)
|
85 |
@app.on_message(filters.command("scan") & filters.reply)
|
|
|
11 |
from DragMusic import app
|
12 |
from motor.motor_asyncio import AsyncIOMotorClient
|
13 |
from config import MONGO_DB_URI
|
14 |
+
from pyrogram.enums import ParseMode
|
15 |
|
16 |
# MongoDB setup
|
17 |
db_client = AsyncIOMotorClient(MONGO_DB_URI)
|
|
|
51 |
@app.on_message(filters.command("nsfw") & filters.group)
|
52 |
async def toggle_nsfw_scan(client: Client, message: Message):
|
53 |
if len(message.command) != 2:
|
54 |
+
return await message.reply("Usage:\n /nsfw enable \n /nsfw disable", parse_mode=ParseMode.HTML)
|
55 |
|
56 |
user_is_admin = await is_admin(client, message.chat.id, message.from_user.id)
|
57 |
if not user_is_admin:
|
|
|
60 |
arg = message.command[1].lower()
|
61 |
if arg == "enable":
|
62 |
await enable_nsfw(message.chat.id)
|
63 |
+
await message.reply("✅ NSFW scanning has been enabled for this group.", parse_mode=ParseMode.HTML)
|
64 |
elif arg == "disable":
|
65 |
await disable_nsfw(message.chat.id)
|
66 |
+
await message.reply("🚫 NSFW scanning has been disabled for this group.", parse_mode=ParseMode.HTML)
|
67 |
else:
|
68 |
+
await message.reply("⚠️ Invalid option. Use /nsfw enable or /nsfw disable", parse_mode=ParseMode.HTML)
|
69 |
|
70 |
# Debug command: /whoami
|
71 |
@app.on_message(filters.command("whoami") & filters.group)
|
|
|
77 |
f"📢 Chat ID: `{message.chat.id}`\n"
|
78 |
f"🛡️ Your status: `{member.status}`",
|
79 |
quote=True,
|
80 |
+
parse_mode=ParseMode.HTML
|
81 |
)
|
82 |
except Exception as e:
|
83 |
+
await message.reply_text(f"❌ Failed to fetch status: {e}", parse_mode=ParseMode.HTML)
|
84 |
|
85 |
# Command: /scan (manual)
|
86 |
@app.on_message(filters.command("scan") & filters.reply)
|