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

Function handler

plugins/truth.ts:10–31  ·  view source on GitHub ↗
(sock: any, message: any, args: any, context: BotContext)

Source from the content-addressed store, hash-verified

8 usage: '.truth',
9
10 async handler(sock: any, message: any, args: any, context: BotContext) {
11 const chatId = context.chatId || message.key.remoteJid;
12
13 try {
14 const shizokeys = 'shizo';
15 const res = await fetch(`https://shizoapi.onrender.com/api/texts/truth?apikey=${shizokeys}`);
16 if (!res.ok) {
17 throw await res.text();
18 }
19 const json = await res.json() as any as any;
20 const truthMessage = json.result;
21
22 await sock.sendMessage(chatId, {
23 text: truthMessage
24 }, { quoted: message });
25 } catch(error: any) {
26 console.error('Error in truth command:', error);
27 await sock.sendMessage(chatId, {
28 text: '❌ Failed to get truth. Please try again later!'
29 }, { quoted: message });
30 }
31 }
32};

Callers

nothing calls this directly

Calls 1

jsonMethod · 0.80

Tested by

no test coverage detected