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

Function handler

plugins/goodnight.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: '.goodnight',
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(
16 `https://shizoapi.onrender.com/api/texts/lovenight?apikey=${shizokeys}`
17 );
18
19 if (!res.ok) {
20 throw new Error(await res.text());
21 }
22
23 const json = await res.json() as any as any;
24 const goodnightMessage = json.result;
25
26 await sock.sendMessage(chatId, { text: goodnightMessage }, { quoted: message });
27
28 } catch(error: any) {
29 console.error('Goodnight plugin error:', error);
30 await sock.sendMessage(chatId, { text: '❌ Failed to get goodnight message. Please try again later!' }, { quoted: message });
31 }}
32};

Callers

nothing calls this directly

Calls 1

jsonMethod · 0.80

Tested by

no test coverage detected