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

Function handler

plugins/tagall.js:9–38  ·  view source on GitHub ↗
(sock, message, args, context)

Source from the content-addressed store, hash-verified

7 groupOnly: true,
8 adminOnly: true,
9 async handler(sock, message, args, context) {
10 const { chatId, channelInfo } = context;
11 try {
12 const groupMetadata = await sock.groupMetadata(chatId);
13 const participants = groupMetadata.participants;
14 if (!participants || participants.length === 0) {
15 await sock.sendMessage(chatId, {
16 text: 'No participants found in the group.',
17 ...channelInfo
18 }, { quoted: message });
19 return;
20 }
21 let messageText = '🔊 *Hello Everyone:*\n\n';
22 participants.forEach((participant) => {
23 messageText += `@${participant.id.split('@')[0]}\n`;
24 });
25 await sock.sendMessage(chatId, {
26 text: messageText,
27 mentions: participants.map((p) => p.id),
28 ...channelInfo
29 });
30 }
31 catch (error) {
32 console.error('Error in tagall command:', error);
33 await sock.sendMessage(chatId, {
34 text: 'Failed to tag all members.',
35 ...channelInfo
36 }, { quoted: message });
37 }
38 }
39};

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected