grupo-pin.js 771 B

12345678910111213141516171819202122232425262728
  1. let handler = async (m, { conn, command }) => {
  2. if (!m.quoted) return m.reply(`⚠️ Responde a un mensaje para ${command === 'pin' ? 'fijarlo' : 'desfijarlo'}.`);
  3. try {
  4. let messageKey = {remoteJid: m.chat,
  5. fromMe: m.quoted.fromMe,
  6. id: m.quoted.id,
  7. participant: m.quoted.sender
  8. };
  9. if (command === 'pin') {
  10. await conn.sendMessage(m.chat, {pin: {type: 1, time: 604800, key: messageKey }});
  11. m.react("✅️")
  12. }
  13. if (command === 'unpin') {
  14. await conn.sendMessage(m.chat, { pin: { type: 0, key: messageKey }});
  15. m.react("✅️")
  16. }} catch (error) {
  17. console.error(error);
  18. }};
  19. handler.help = ['pin']
  20. handler.tags = ['group']
  21. handler.command = ['pin', 'unpin']
  22. handler.admin = true
  23. handler.group = true
  24. handler.botAdmin = true
  25. handler.register = true
  26. export default handler