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

Function handler

plugins/teddy.ts:12–53  ·  view source on GitHub ↗
(sock: any, message: any, args: any, context: BotContext)

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 1

sleepFunction · 0.70

Tested by

no test coverage detected