Files
wehub-resource-sync 9b395f5cc3
E2E Headed Chrome / e2e-headed (macos-15) (push) Has been cancelled
E2E Headed Chrome / e2e-headed (ubuntu-latest) (push) Has been cancelled
E2E Headed Chrome / e2e-headed (windows-latest) (push) Has been cancelled
CI / build (macos-latest) (push) Has been cancelled
CI / build (ubuntu-latest) (push) Has been cancelled
CI / build (windows-latest) (push) Has been cancelled
CI / unit-test (push) Has been cancelled
CI / bun-test (push) Has been cancelled
CI / adapter-test (push) Has been cancelled
CI / smoke-test (macos-latest) (push) Has been cancelled
CI / smoke-test (ubuntu-latest) (push) Has been cancelled
Security Audit / audit (push) Has been cancelled
Build Chrome Extension / build (push) Has been cancelled
Trigger Website Rebuild (Docs Updated) / dispatch (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 12:39:48 +08:00

46 lines
1.4 KiB
JavaScript

import { cli } from '@jackwener/opencli/registry';
cli({
site: 'facebook',
name: 'join-group',
access: 'write',
description: 'Join a Facebook group',
domain: 'www.facebook.com',
args: [
{
name: 'group',
required: true,
positional: true,
help: `Group ID or URL path (e.g. '1876150192925481' or group name)`,
},
],
columns: ['status', 'group'],
pipeline: [
{ navigate: { url: 'https://www.facebook.com/groups/${{ args.group }}', settleMs: 3000 } },
{ evaluate: `(async () => {
const group = \${{ args.group | json }};
const groupName = document.querySelector('h1')?.textContent?.trim() || group;
// Find "Join Group" button
const buttons = Array.from(document.querySelectorAll('[role="button"]'));
const joinBtn = buttons.find(b => {
const text = b.textContent.trim();
return text === '加入小组' || text === 'Join group' || text === 'Join Group';
});
if (!joinBtn) {
const isMember = buttons.some(b => {
const t = b.textContent.trim();
return t === '已加入' || t === 'Joined' || t === '成员' || t === 'Member';
});
if (isMember) return [{ status: 'Already a member', group: groupName }];
return [{ status: 'Join button not found', group: groupName }];
}
joinBtn.click();
await new Promise(r => setTimeout(r, 1500));
return [{ status: 'Join request sent', group: groupName }];
})()
` },
],
});