commands/_ban.js
javascript · 26 lines
1/**#command2name: /ban3answer: 4keyboard: 5parse_mode: html6aliases: 7allow_only_group: true8need_reply: true9is_web: 010#command**/11 12let reply = message.reply_to_message;13if (!reply) {14 Api.sendMessage({ chat_id: chat.id, text: "⚠️ Please reply to the user you want to ban." });15 return;16}17Api.banChatMember({18 chat_id: chat.id,19 user_id: reply.from.id20}, function(success, result) {21 if (success) {22 Api.sendMessage({ chat_id: chat.id, text: "✅ User <b>" + (reply.from.first_name || "User")#[0] + "</b> has been banned.", parse_mode: "HTML" });23 } else {24 Api.sendMessage({ chat_id: chat.id, text: "❌ Failed to ban user. Make sure I am an admin with ban permissions." });25 }26});