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

Function handler

plugins/quote.ts:9–24  ·  view source on GitHub ↗
(sock: any, message: any, args: any, context: BotContext)

Source from the content-addressed store, hash-verified

7 description: 'Get a random quote',
8 usage: '.quote',
9 async handler(sock: any, message: any, args: any, context: BotContext) {
10 const chatId = context.chatId || message.key.remoteJid;
11 try {
12 const apiKey = 'shizo';
13 const res = await fetch(`https://shizoapi.onrender.com/api/texts/quotes?apikey=${apiKey}`);
14 if (!res.ok) throw await res.text();
15 const json = await res.json() as any as any;
16 const quoteMessage = json.result;
17 await sock.sendMessage(chatId, { text: quoteMessage }, { quoted: message });
18 } catch(error: any) {
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