|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const { cmd ,commands } = require('../command'); |
|
const { exec } = require('child_process'); |
|
const config = require('../config'); |
|
const {sleep} = require('../lib/functions') |
|
|
|
cmd({ |
|
pattern: "shutdown", |
|
desc: "Shutdown the bot.", |
|
category: "owner", |
|
react: "π", |
|
filename: __filename |
|
}, |
|
async (conn, mek, m, { from, isOwner, reply }) => { |
|
if (!isOwner) return reply("β You are not the owner!"); |
|
reply("π Shutting down...").then(() => process.exit()); |
|
}); |
|
|
|
cmd({ |
|
pattern: "broadcast", |
|
desc: "Broadcast a message to all groups.", |
|
category: "owner", |
|
react: "π’", |
|
filename: __filename |
|
}, |
|
async (conn, mek, m, { from, isOwner, args, reply }) => { |
|
if (!isOwner) return reply("β You are not the owner!"); |
|
if (args.length === 0) return reply("π’ Please provide a message to broadcast."); |
|
const message = args.join(' '); |
|
const groups = Object.keys(await conn.groupFetchAllParticipating()); |
|
for (const groupId of groups) { |
|
await conn.sendMessage(groupId, { text: message }, { quoted: mek }); |
|
} |
|
reply("π’ Message broadcasted to all groups."); |
|
}); |
|
|
|
cmd({ |
|
pattern: "setpp", |
|
desc: "Set bot profile picture.", |
|
category: "owner", |
|
react: "πΌοΈ", |
|
filename: __filename |
|
}, |
|
async (conn, mek, m, { from, isOwner, quoted, reply }) => { |
|
if (!isOwner) return reply("β You are not the owner!"); |
|
if (!quoted || !quoted.message.imageMessage) return reply("β Please reply to an image."); |
|
try { |
|
const media = await conn.downloadMediaMessage(quoted); |
|
await conn.updateProfilePicture(conn.user.jid, { url: media }); |
|
reply("πΌοΈ Profile picture updated successfully!"); |
|
} catch (error) { |
|
reply(`β Error updating profile picture: ${error.message}`); |
|
} |
|
}); |
|
|
|
|
|
cmd({ |
|
pattern: "clearchats", |
|
desc: "Clear all chats from the bot.", |
|
category: "owner", |
|
react: "π§Ή", |
|
filename: __filename |
|
}, |
|
async (conn, mek, m, { from, isOwner, reply }) => { |
|
if (!isOwner) return reply("β You are not the owner!"); |
|
try { |
|
const chats = conn.chats.all(); |
|
for (const chat of chats) { |
|
await conn.modifyChat(chat.jid, 'delete'); |
|
} |
|
reply("π§Ή All chats cleared successfully!"); |
|
} catch (error) { |
|
reply(`β Error clearing chats: ${error.message}`); |
|
} |
|
}); |
|
|
|
cmd({ |
|
pattern: "jid", |
|
desc: "Get the bot's JID.", |
|
category: "owner", |
|
react: "π€", |
|
filename: __filename |
|
}, |
|
async (conn, mek, m, { from, isOwner, reply }) => { |
|
if (!isOwner) return reply("β You are not the owner!"); |
|
reply(`π€ *Bot JID:* ${conn.user.jid}`); |
|
}); |
|
|
|
cmd({ |
|
pattern: "gjid", |
|
desc: "Get the list of JIDs for all groups the bot is part of.", |
|
category: "owner", |
|
react: "π", |
|
filename: __filename |
|
}, |
|
async (conn, mek, m, { from, isOwner, reply }) => { |
|
if (!isOwner) return reply("β You are not the owner!"); |
|
const groups = await conn.groupFetchAllParticipating(); |
|
const groupJids = Object.keys(groups).join('\n'); |
|
reply(`π *Group JIDs:*\n\n${groupJids}`); |
|
}); |
|
|
|
|
|
|
|
|
|
cmd({ |
|
pattern: "block", |
|
desc: "Block a user.", |
|
category: "owner", |
|
react: "π«", |
|
filename: __filename |
|
}, |
|
async (conn, mek, m, { from, isOwner, quoted, reply }) => { |
|
if (!isOwner) return reply("β You are not the owner!"); |
|
if (!quoted) return reply("β Please reply to the user you want to block."); |
|
const user = quoted.sender; |
|
try { |
|
await conn.updateBlockStatus(user, 'block'); |
|
reply(`π« User ${user} blocked successfully.`); |
|
} catch (error) { |
|
reply(`β Error blocking user: ${error.message}`); |
|
} |
|
}); |
|
|
|
cmd({ |
|
pattern: "unblock", |
|
desc: "Unblock a user.", |
|
category: "owner", |
|
react: "β
", |
|
filename: __filename |
|
}, |
|
async (conn, mek, m, { from, isOwner, quoted, reply }) => { |
|
if (!isOwner) return reply("β You are not the owner!"); |
|
if (!quoted) return reply("β Please reply to the user you want to unblock."); |
|
const user = quoted.sender; |
|
try { |
|
await conn.updateBlockStatus(user, 'unblock'); |
|
reply(`β
User ${user} unblocked successfully.`); |
|
} catch (error) { |
|
reply(`β Error unblocking user: ${error.message}`); |
|
} |
|
}); |
|
|