commands/_antiforward.js
javascript · 28 lines
1/**#command2name: /antiforward3answer: 4keyboard: 5parse_mode: html6aliases: 7allow_only_group: true8need_reply: false9is_web: 010#command**/11 12let chat_id = chat.id;13let member = Api.getChatMember({ chat_id: chat_id, user_id: request.from.id });14 15if (!member || (member.status !== "creator" && member.status !== "administrator")) {16 Api.sendMessage({ chat_id: chat_id, text: "⚠️ Only group admins or owners can use this command." });17 return;18}19 20let params = params ? params.trim().toLowerCase() : "";21if (params !== "on" && params !== "off") {22 let current = Bot.getProperty("antiforward_" + chat_id, "off");23 Api.sendMessage({ chat_id: chat_id, text: "↗️ <b>Anti-Forward</b> status: <code>" + current.toUpperCase() + "</code>\nUse <code>/antiforward on</code> or <code>/antiforward off</code> to change.", parse_mode: "HTML" });24 return;25}26 27Bot.setProperty("antiforward_" + chat_id, params, "string");28Api.sendMessage({ chat_id: chat_id, text: "✅ Anti-Forward has been turned <b>" + params.toUpperCase() + "</b>.", parse_mode: "HTML" });