MCPcopy Create free account
hub / github.com/GlobalTechInfo/MEGA-MD / handler

Function handler

plugins/teddy.js:9–45  ·  view source on GitHub ↗
(sock, message, args, context)

Source from the content-addressed store, hash-verified

7 description: 'Send an animated teddy with cute emojis',
8 usage: '.teddy',
9 async handler(sock, message, args, context) {
10 const chatId = context.chatId || message.key.remoteJid;
11 const sender = message.key.participant || message.key.remoteJid;
12 if (teddyUsers[sender])
13 return;
14 teddyUsers[sender] = true;
15 const teddyEmojis = [
16 '❤', '💕', '😻', '🧡', '💛', '💚', '💙', '💜', '🖤', '❣',
17 '💞', '💓', '💗', '💖', '💘', '💝', '💟', '♥', '💌', '🙂',
18 '🤗', '😌', '😉', '🤗', '😊', '🎊', '🎉', '🎁', '🎈'
19 ];
20 try {
21 const pingMsg = await sock.sendMessage(chatId, { text: `(\\_/)\n( •.•)\n/>🤍` }, { quoted: message });
22 for (let i = 0; i < teddyEmojis.length; i++) {
23 await sleep(500);
24 await sock.relayMessage(chatId, {
25 protocolMessage: {
26 key: pingMsg.key,
27 type: 14,
28 editedMessage: {
29 conversation: `(\\_/)\n( •.•)\n/>${teddyEmojis[i]}`
30 }
31 }
32 }, {});
33 }
34 }
35 catch (err) {
36 console.error('Error in teddy command:', err);
37 try {
38 await sock.sendMessage(chatId, { text: '❌ Something went wrong while sending teddy emojis.' }, { quoted: message });
39 }
40 catch { }
41 }
42 finally {
43 delete teddyUsers[sender];
44 }
45 }
46};

Callers

nothing calls this directly

Calls 1

sleepFunction · 0.70

Tested by

no test coverage detected