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

Function handler

plugins/dado.js:7–30  ·  view source on GitHub ↗
(sock, message, _args, _context)

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected