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

Function handler

plugins/quote.js:7–24  ·  view source on GitHub ↗
(sock, message, args, context)

Source from the content-addressed store, hash-verified

5 description: 'Get a random quote',
6 usage: '.quote',
7 async handler(sock, message, args, context) {
8 const chatId = context.chatId || message.key.remoteJid;
9 try {
10 const apiKey = 'shizo';
11 const res = await fetch(`https://shizoapi.onrender.com/api/texts/quotes?apikey=${apiKey}`);
12 if (!res.ok)
13 throw await res.text();
14 const json = await res.json();
15 const quoteMessage = json.result;
16 await sock.sendMessage(chatId, { text: quoteMessage }, { quoted: message });
17 }
18 catch (error) {
19 console.error('Quote Command Error:', error);
20 await sock.sendMessage(chatId, {
21 text: '❌ Failed to get quote. Please try again later!'
22 }, { quoted: message });
23 }
24 }
25};

Callers

nothing calls this directly

Calls 1

jsonMethod · 0.80

Tested by

no test coverage detected