Cloner / plugins /opentime-closetime.js
𝗗𝗔𝗥𝗥𝗘𝗟𝗟 𝗠𝗨𝗖𝗛𝗘𝗥𝗜 ⚡
SUBZERO - MD
8d8d92b unverified
raw
history blame
10.2 kB
/*╺╺╺╺╺╺╺╺╺╺╺╺╺╺╺╺╺╺╺╺╺╺╺╺╺╺╺
⭐PROJECT NAME:
SUBZERO WHATSAPP MD BOT
⭐DEVELOPER
MR FRANK
⭐ MY TEAM
XERO CODERS
⭐ OUR WEBSITE
https://github.com/ZwSyntax/SUBZERO-MD
© TRY DECRYPTING IF YOU CAN⚠
╺╺╺╺╺╺╺╺╺╺╺╺╺╺╺╺╺╺╺╺╺╺╺╺╺╺╺╺╺╺╺╺*/
const config = require('../config')
const { cmd, commands } = require('../command')
cmd({
pattern: "opentime",
react: "🔖",
desc: "To open group to a time",
category: "group",
use: '.opentime',
filename: __filename
},
async(conn, mek, m,{from, prefix, l, quoted, body, isCmd, command, args, q, isGroup, sender, senderNumber, botNumber2, botNumber, pushname, isMe, isOwner, groupMetadata, groupName, participants, groupAdmins, isBotAdmins, isAdmins, reply}) => {
try{
if (!isGroup) return reply(ONLGROUP)
if (!isAdmins) return reply(ADMIN)
if (args[1] == 'second') {
var timer = args[0] * `1000`
} else if (args[1] == 'minute') {
var timer = args[0] * `60000`
} else if (args[1] == 'hour') {
var timer = args[0] * `3600000`
} else if (args[1] == 'day') {
var timer = args[0] * `86400000`
} else {
return reply('*select:*\nsecond\nminute\nhour\n\n*example*\n10 second')
}
reply(`Open time ${q} starting from now`)
setTimeout(() => {
var nomor = mek.participant
const open = `*OPEN TIME* THE GROUP WAS OPENED BY KERM_MD-V4 TO APPROVED ADMIN\n NOW MEMBERS CAN SEND MESSAGES 🔓`
conn.groupSettingUpdate(from, 'not_announcement')
reply(open)
}, timer)
await conn.sendMessage(from, { react: { text: `✅`, key: mek.key }})
} catch (e) {
reply('*Error !!*')
l(e)
}
})
cmd({
pattern: "closetime",
react: "🔖",
desc: "To close group to a time",
category: "group",
use: '.closstime',
filename: __filename
},
async(conn, mek, m,{from, prefix, l, quoted, body, isCmd, command, args, q, isGroup, sender, senderNumber, botNumber2, botNumber, pushname, isMe, isOwner, groupMetadata, groupName, participants, groupAdmins, isBotAdmins, isAdmins, reply}) => {
try{
if (!isGroup) return reply(ONLGROUP)
if (!isAdmins) return reply(ADMIN)
if (args[1] == 'second') {
var timer = args[0] * `1000`
} else if (args[1] == 'minute') {
var timer = args[0] * `60000`
} else if (args[1] == 'hour') {
var timer = args[0] * `3600000`
} else if (args[1] == 'day') {
var timer = args[0] * `86400000`
} else {
return reply('*select:*\nsecond\nminute\nhour\n\n*Example*\n10 second')
}
reply(`Close time ${q} starting from now`)
setTimeout(() => {
var nomor = m.participant
const close = `*CLOSE TIME* GROUP CLOSED BY KERM_MD-V4 AT APPROVED ADMIN\nNOW ONLY ADMIN CAN SEND MESSAGES 🔐`
conn.groupSettingUpdate(from, 'announcement')
reply(close)
}, timer)
await conn.sendMessage(from, { react: { text: `✅`, key: mek.key }})
} catch (e) {
reply('*Error !!*')
l(e)
}
})
cmd({
pattern: "tagadmin",
alais:["tagadmins"],
react: "🙀",
desc: "Tags all the admins in the group.",
category: "group",
filename: __filename,
},
async(conn, mek, m,{from, prefix, l, quoted, body, isCmd, command, args, q, isGroup, sender, senderNumber, botNumber2, botNumber, pushname, isMe, isOwner, groupMetadata, groupName, participants, groupAdmins, isBotAdmins, isAdmins, reply}) => {
try{
// Check if the command is used in a group
if (!isGroup) return reply(`This command is only for groups.`);
if (!isAdmins) return reply(`This command is only for group admin.`);
// Fetch all group admins
const admins = groupAdmins;
if (admins.length === 0) {
return reply('There are no admins in this group.');
}
// Create a message with all admin tags
let adminTagMessage = '*TAGGING ALL ADMINS IN THE GROUP 🔳:*\n\n';
for (let admin of admins) {
adminTagMessage += `@${admin.split('@')[0]}\n`; // Mention each admin by their number
}
// Send the message and tag the admins
await conn.sendMessage(from, { text: adminTagMessage, mentions: admins }, { quoted: mek });
} catch (e) {
console.error('Error tagging admins:', e);
reply('you are not an admin.');
}
})
cmd({
pattern: "mute",
alias: ["lock"],
react: "🔒",
desc: "mute group.",
category: "group",
filename: __filename,
},
async(conn, mek, m,{from, l, quoted, body, isCmd, command, args, q, isGroup, sender, senderNumber, botNumber2, botNumber, pushname, isMe, isOwner, groupMetadata, groupName, participants, isItzcp, groupAdmins, isBotAdmins, isAdmins, reply}) => {
try{
if (!isOwner || !isAdmins) return;
if (!m.isGroup) return reply(mg.onlygroup);
if (!isBotAdmins) return reply(mg.needbotadmins);
await conn.groupSettingUpdate(m.chat, "announcement")
const mass = await conn.sendMessage(m.chat, { text: '*GROUP CHAT MUTED BY KERM_MD-V4* 🔒' }, { quoted: mek });
return await conn.sendMessage(m.chat, { react: { text: '🔒', key: mass.key } });
} catch(e) {
console.log(e);
reply('*PLEASE GIVE ME A ADDMIN ROLE❗👻*')
}
})
cmd({
pattern: "unmute",
alias: ["unlock"],
react: "🔓",
desc: "unmute group.",
category: "group",
filename: __filename,
},
async(conn, mek, m,{from, l, quoted, body, isCmd, command, args, q, isGroup, sender, senderNumber, botNumber2, botNumber, pushname, isMe, isOwner, groupMetadata, groupName, participants, isItzcp, groupAdmins, isBotAdmins, isAdmins, reply}) => {
try{
if (!isOwner || !isAdmins) return;
if (!m.isGroup) return reply(mg.onlygroup);
if (!isBotAdmins) return reply(mg.needbotadmins);
await conn.groupSettingUpdate(m.chat, "not_announcement")
const mass = await conn.sendMessage(m.chat, { text: '*GROUP CHAT UNMUTED BY KERM_MD-V4* 🔒' }, { quoted: mek });
return await conn.sendMessage(m.chat, { react: { text: '🔒', key: mass.key } });
} catch(e) {
console.log(e);
reply('*PLEASE GIVE ME A ADDMIN ROLE❗👻*')
}
})
cmd({
pattern: "add",
alias: ["aja"],
react: "➕",
desc: "Adds a user to the group.",
category: "group",
filename: __filename,
use: '<number>',
},
async (conn, mek, m, { from, quoted, body, isCmd, command, args, q, isGroup, sender, senderNumber, botNumber2, botNumber, pushname, isMe, isOwner, groupMetadata, groupName, participants, groupAdmins, isBotAdmins, isAdmins, reply }) => {
try {
// Check if the command is used in a group
if (!m.isGroup) return reply(`This command is only for groups.`);
// Check if the bot has admin privileges
if (!isBotAdmins) return reply(`I need admin privileges to add users.`);
// Check if the number is provided (from q or args)
if (!q || isNaN(q)) return reply('Please provide a valid phone number to add.');
const userToAdd = `${q}@s.whatsapp.net`; // Format the phone number
// Add the user to the group
await conn.groupParticipantsUpdate(m.chat, [userToAdd], "add");
// Confirm the addition
reply(`User ${q} has been added to the group.`);
} catch (e) {
console.error('Error adding user:', e);
reply('An error occurred while adding the user. Please make sure the number is correct and they are not already in the group.');
}
})
cmd({
pattern: "setgoodbye",
desc: "Set the goodbye message for the group.",
category: "group",
react: "👋",
filename: __filename
},
async (conn, mek, m, { from, quoted, body, isCmd, command, args, q, isGroup, sender, senderNumber, botNumber2, botNumber, pushname, isMe, isOwner, groupMetadata, groupName, participants, groupAdmins, isBotAdmins, isAdmins, reply }) => {
try {
if (!isGroup) return reply('This command can only be used in a group.')
if (!isBotAdmins) return reply('Bot must be an admin to use this command.')
if (!isAdmins) return reply('You must be an admin to use this command.')
const goodbye = q
if (!goodbye) return reply('Please provide a goodbye message.')
await conn.sendMessage(from, { image: { url: config.ALIVE_IMG }, caption: goodbye })
await reply('Goodbye message has been set.')
} catch (e) {
console.log(e)
reply(`${e}`)
}
})
cmd({
pattern: "setwelcome",
desc: "Set the welcome message for the group.",
category: "group",
react: "👋",
filename: __filename
},
async (conn, mek, m, { from, quoted, body, isCmd, command, args, q, isGroup, sender, senderNumber, botNumber2, botNumber, pushname, isMe, isOwner, groupMetadata, groupName, participants, groupAdmins, isBotAdmins, isAdmins, reply }) => {
try {
if (!isGroup) return reply('This command can only be used in a group.')
if (!isBotAdmins) return reply('Bot must be an admin to use this command.')
if (!isAdmins) return reply('You must be an admin to use this command.')
const welcome = q
if (!welcome) return reply('Please provide a welcome message.')
await conn.sendMessage(from, { image: { url: config.ALIVE_IMG }, caption: welcome })
await reply('Welcome message has been set.')
} catch (e) {
console.log(e)
reply(`${e}`)
}
});