revenge-bundle-next/plugins/staff-settings/index.ts
PalmDevs f87c1fb584
feat(lib/plugins)!: change how plugin system works
- Separated plugin flags for statuses
- Disallow access to internal plugin flags in plugin APIs
- await `handleError` when plugin throws an error
- Added safe guards to prevent initing/starting a plugin twice or when it is not enabled
- Call GC after plugin stops
- Await plugin init and start before stopping
2025-05-01 01:18:41 +07:00

24 lines
758 B
TypeScript

import { findModule } from '@revenge-mod/modules/finders'
import { byProps } from '@revenge-mod/modules/finders/filters'
import { after } from '@revenge-mod/patcher'
import { PluginFlags } from '@revenge-mod/plugins'
import { InternalPluginFlags, registerPlugin } from '@revenge-mod/plugins/_'
registerPlugin(
{
id: 'revenge.staff-settings',
name: 'Staff Settings',
description: "Allows accessing Discord's Staff Settings.",
icon: 'StaffBadgeIcon',
},
{
async init({ cleanup }) {
const UserStoreUtils = await findModule(byProps('isStaffEnv'))
cleanup(after(UserStoreUtils, 'isStaffEnv', () => true))
},
},
PluginFlags.Enabled,
InternalPluginFlags.Internal,
)