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

Function getBotAdminStatus

plugins/antispam.js:52–75  ·  view source on GitHub ↗
(participants, sock)

Source from the content-addressed store, hash-verified

50 });
51}
52function getBotAdminStatus(participants, sock) {
53 const botId = sock.user?.id || '';
54 const botLid = sock.user?.lid || '';
55 const botNum = botId.split('@')[0].split(':')[0];
56 const botLidNum = botLid.split('@')[0].split(':')[0];
57 return participants.some((p) => {
58 if (p.admin !== 'admin' && p.admin !== 'superadmin')
59 return false;
60 const pId = (p.id || '');
61 const pLid = (p.lid || '');
62 const pNum = pId.split('@')[0].split(':')[0];
63 const pLidNum = pLid.split('@')[0].split(':')[0];
64 const pPhone = p.phoneNumber ? p.phoneNumber.split('@')[0] : '';
65 return (pId === botId ||
66 pId === botLid ||
67 pLid === botLid ||
68 pLid === botId ||
69 pNum === botNum ||
70 pLidNum === botLidNum ||
71 pNum === botLidNum ||
72 pLidNum === botNum ||
73 pPhone === botNum);
74 });
75}
76const DEFAULT_GROUP_CONFIG = {
77 enabled: false,
78 maxMessages: 5,

Callers 1

handleAntiSpamFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected