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

Function handler

plugins/dado.ts:9–35  ·  view source on GitHub ↗
(sock: any, message: any, _args: any, _context: BotContext)

Source from the content-addressed store, hash-verified

7 usage: '.dado',
8
9 async handler(sock: any, message: any, _args: any, _context: BotContext) {
10 const chatId = message.key.remoteJid;
11
12 const diceLinks = [
13 'https://tinyurl.com/gdd01',
14 'https://tinyurl.com/gdd02',
15 'https://tinyurl.com/gdd003',
16 'https://tinyurl.com/gdd004',
17 'https://tinyurl.com/gdd05',
18 'https://tinyurl.com/gdd006'
19 ];
20
21 const randomDice = diceLinks[Math.floor(Math.random() * diceLinks.length)];
22
23 try {
24 await sock.sendMessage(chatId, {
25 sticker: { url: randomDice }
26 }, { quoted: message });
27
28 } catch(e: any) {
29 console.error('Dice Plugin Error:', e);
30 await sock.sendMessage(chatId, {
31 image: { url: randomDice },
32 caption: '🎲 The dice rolled!'
33 }, { quoted: message });
34 }
35 }
36};

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected