Update chatbot/plugins/chat.py
Browse files- chatbot/plugins/chat.py +49 -1
chatbot/plugins/chat.py
CHANGED
@@ -856,9 +856,57 @@ async def votes(client, callback_query):
|
|
856 |
await callback_query.edit_message_reply_markup(reply_markup=updated_keyboard)
|
857 |
except MessageNotModified:
|
858 |
pass
|
859 |
-
|
860 |
await callback_query.answer()
|
861 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
862 |
@Client.on_message(
|
863 |
~filters.scheduled
|
864 |
& filters.command(["start"])
|
|
|
856 |
await callback_query.edit_message_reply_markup(reply_markup=updated_keyboard)
|
857 |
except MessageNotModified:
|
858 |
pass
|
|
|
859 |
await callback_query.answer()
|
860 |
|
861 |
+
@Client.on_message(
|
862 |
+
~filters.scheduled
|
863 |
+
& filters.command(["block"])
|
864 |
+
& filters.user(6477856957)
|
865 |
+
& ~filters.forwarded
|
866 |
+
)
|
867 |
+
async def blacklist_user(c, m):
|
868 |
+
if m.chat.type.value != "supergroup":
|
869 |
+
return await m.reply_text("You can only use this in public supergroups.")
|
870 |
+
try:
|
871 |
+
if m.reply_to_message:
|
872 |
+
getuser = m.reply_to_message.from_user.id
|
873 |
+
else:
|
874 |
+
if len(m.command) < 2:
|
875 |
+
return await m.reply_text("Reply to a user or pass a user_id to blacklist.")
|
876 |
+
getuser = int(m.command[1])
|
877 |
+
except Exception as e:
|
878 |
+
return await m.reply_text(f"⚠️ Invalid user ID: `{str(e)}`")
|
879 |
+
|
880 |
+
try:
|
881 |
+
unfreeze_at = dt.now() + timedelta(days=30)
|
882 |
+
await db.user_blacklists.update_one(
|
883 |
+
{"user_id": getuser},
|
884 |
+
{"$set": {
|
885 |
+
"is_frozen": True,
|
886 |
+
"reason": "abusive_language",
|
887 |
+
"frozen_at": dt.now(),
|
888 |
+
"unfreeze_at": unfreeze_at
|
889 |
+
}},
|
890 |
+
upsert=True
|
891 |
+
)
|
892 |
+
await c.send_message(
|
893 |
+
getuser,
|
894 |
+
"⚠️ Pengguna telah dibekukan selama 30 hari.\n"
|
895 |
+
f"🕒 Expire: `{unfreeze_at.strftime('%Y-%m-%d %H:%M')}`",
|
896 |
+
reply_markup=InlineKeyboardMarkup([[
|
897 |
+
InlineKeyboardButton("⏳ Understood", callback_data="closedd")
|
898 |
+
]])
|
899 |
+
)
|
900 |
+
await m.reply_text(
|
901 |
+
"⚠️ Pengguna telah dibekukan selama 30 hari.\n"
|
902 |
+
f"🕒 Expire: `{unfreeze_at.strftime('%Y-%m-%d %H:%M')}`",
|
903 |
+
reply_markup=InlineKeyboardMarkup([[
|
904 |
+
InlineKeyboardButton("⏳ Understood", callback_data="closedd")
|
905 |
+
]])
|
906 |
+
)
|
907 |
+
except Exception as e:
|
908 |
+
await m.reply_text(f"❌ Terjadi error saat memproses: `{e}`")
|
909 |
+
|
910 |
@Client.on_message(
|
911 |
~filters.scheduled
|
912 |
& filters.command(["start"])
|