owner-cmd.js 3.3 KB

123456789101112131415161718192021222324252627282930313233343536
  1. const handler = async (m, {conn, text, usedPrefix, command}) => {
  2. global.db.data.sticker = global.db.data.sticker || {};
  3. if (command == 'addcmd' || command == 'setcmd') {
  4. if (!m.quoted) throw '⚠️ ʀᴇsᴘᴏɴᴅᴇ ᴀʟ ᴜɴ sᴛɪᴄᴋᴇʀ ᴏ ɪᴍᴀɢᴇɴ ᴀʟ ᴄᴜᴀʟ ᴅᴇsᴇᴀ ᴀɢʀᴇɢᴀʀ ᴜɴ ᴄᴏᴍᴀɴᴅᴏ ᴏ ᴛᴇxᴛᴏ';
  5. if (!m.quoted.fileSha256) throw '⚠️ sᴏʟᴏ ᴘᴜᴇᴅᴇs ᴀsɪɢɴᴀʀᴀʀ ᴄᴏᴍᴀɴᴅᴏs ᴏ ᴛᴇxᴛᴏs ᴀ sᴛɪᴄᴋᴇʀ ᴇ ɪᴍᴀɢᴇɴ*';
  6. if (!text) throw `*⚠️ ʀᴇsᴘᴏɴᴅᴇ ᴀʟ ᴜɴ sᴛɪᴄᴋᴇʀ ᴏ ɪᴍᴀɢʀɴ ᴀʟ ᴄᴜᴀʟ ᴅᴇsᴇᴀ ᴀɢʀᴇɢᴀʀ ᴜɴ ᴄᴏᴍᴀɴᴅᴏ ᴏ ᴛᴇxᴛᴏ*\n*• ᴇᴊᴇᴍᴘʟᴏ:* ${usedPrefix + command} <texto> <responder a sticker o imagen`;
  7. const sticker = global.db.data.sticker;
  8. const hash = m.quoted.fileSha256.toString('base64');
  9. if (sticker[hash] && sticker[hash].locked) throw '⚠️ ᴛᴜ ᴏ̨ᴜɪᴇɴ ᴄᴀʀᴀᴊᴏ ᴇʀᴇs? 🧐, sᴏʟᴏ ᴍɪ ᴊᴇғᴇ ᴘᴜᴇᴅᴇ ᴜsᴀʀ ᴇsᴛᴇ ᴄᴏᴍᴀɴᴅᴏ*';
  10. sticker[hash] = {text, mentionedJid: m.mentionedJid, creator: m.sender, at: + new Date, locked: false};
  11. m.reply(`*✅ ᴇʟ ᴛᴇxᴛᴏ/ᴄᴏᴍᴀɴᴅᴏ ᴀsɪɢɴᴀᴅᴏ ᴀʟ sᴛɪᴄᴋᴇʀ/ɪᴍᴀɢᴇɴ ғᴜᴇ ᴀɢʀᴇɢᴀᴅᴏ ᴀ ʟᴀ ʙᴀsᴇ ᴅᴇ ᴅᴀᴛᴏs ᴄᴏʀʀᴇᴄᴛᴀᴍᴇɴᴛᴇ*`);
  12. m.react("✅")
  13. };
  14. if (command == 'delcmd') {
  15. let hash = text;
  16. if (m.quoted && m.quoted.fileSha256) hash = m.quoted.fileSha256.toString('hex');
  17. if (!hash) throw `*[❗𝐈𝐍𝐅𝐎❗] 𝚂𝙾𝙻𝙾 𝚂𝙴 𝙿𝚄𝙴𝙳𝙴𝙽 𝙰𝚂𝙸𝙶𝙽𝙰𝚁 𝚃𝙴𝚇𝚃𝙾𝚂 𝙾 𝙲𝙾𝙼𝙰𝙽𝙳𝙾𝚂 𝙰𝚂𝙸𝙶𝙽𝙰𝙳𝙾𝚂 𝙰 𝚂𝚃𝙸𝙲𝙺𝙴𝚁𝚂 𝙾 𝙸𝙼𝙰𝙶𝙴𝙽𝙴𝚂, 𝙿𝙰𝚁𝙰 𝙾𝙱𝚃𝙴𝙽𝙴𝚁 𝙴𝙻 𝙲𝙾𝙳𝙸𝙶𝙾 𝙰𝚂𝙸𝙶𝙽𝙰𝙳𝙾 𝚄𝚂𝙴 𝙴𝙻 𝙲𝙾𝙼𝙰𝙽𝙳𝙾 ${usedPrefix}listcmd*`;
  18. const sticker = global.db.data.sticker;
  19. if (sticker[hash] && sticker[hash].locked) throw '⚠️ ᴛᴜ ᴏ̨ᴜɪᴇɴ ᴄᴀʀᴀᴊᴏ ᴇʀᴇs? 🧐, sᴏʟᴏ ᴍɪ ᴊᴇғᴇ ᴘᴜᴇᴅᴇ ᴜsᴀʀ ᴇsᴛᴇ ᴄᴏᴍᴀɴᴅᴏ*';
  20. delete sticker[hash];
  21. m.reply(`*✅ ᴇʟ ᴛᴇxᴛᴏ/ᴄᴏᴍᴀɴᴅᴏ ᴀsɪɢɴᴀᴅᴏ ᴀʟ sᴛɪᴄᴋᴇʀ/ɪᴍᴀɢᴇɴ ғᴜᴇ ᴇʟɪᴍɪɴᴀᴅᴏ ᴅᴇ ʟᴀ ʙᴀsᴇ ᴅᴇ ᴅᴀᴛᴏs ᴄᴏʀʀᴇᴄᴛᴀᴍᴇɴᴛᴇ*`);
  22. }
  23. if (command == 'listcmd' || command == 'cmdlist') {
  24. conn.reply(m.chat, `*< 𝘓𝘐𝘚𝘛𝘈 𝘋𝘌 𝘊𝘖𝘔𝘈𝘕𝘋𝘖𝘚 / 𝘛𝘌𝘟𝘛𝘖𝘚 𝘈𝘚𝘐𝘎𝘈𝘕𝘋𝘖𝘚 />*
  25. ${Object.entries(global.db.data.sticker).map(([key, value], index) => `*${index + 1}.-*\n*ᴄᴏᴅɪɢᴏ:* ${value.locked ? `_*(ʙʟᴏǫᴜᴇᴀᴅᴏ)*_ ${key}` : key}\n*ᴄᴏᴍᴀɴᴅᴏ/ᴛᴇxᴛᴏ:* ${value.text}`).join('\n\n')}
  26. `.trim(), null, {mentions: Object.values(global.db.data.sticker).map((x) => x.mentionedJid).reduce((a, b) => [...a, ...b], [])});
  27. }}
  28. handler.help = ['addcmd', 'delcmd', 'listcmd']
  29. handler.tags = ['owner']
  30. handler.command = ['setcmd', 'addcmd', 'cmdadd', 'cmdset', 'delcmd', 'listcmd', 'cmdlist'];
  31. handler.rowner = true;
  32. export default handler;