- 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
24 lines
758 B
TypeScript
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,
|
|
)
|