feat(lib/init): load plugins on startup
This commit is contained in:
parent
020045f2eb
commit
f19c8e925a
3 changed files with 28 additions and 0 deletions
|
|
@ -20,8 +20,12 @@ onModuleFirstRequired(
|
|||
onModuleInitialized(
|
||||
0,
|
||||
runCatching(function onceIndexInitialized() {
|
||||
// Register all plugins
|
||||
require('@plugins/all')
|
||||
|
||||
// Initialize init libraries
|
||||
require('@revenge-mod/assets/init')
|
||||
require('@revenge-mod/plugins/init')
|
||||
|
||||
logger.log('Revenge loaded!')
|
||||
|
||||
|
|
|
|||
1
plugins/all.ts
Normal file
1
plugins/all.ts
Normal file
|
|
@ -0,0 +1 @@
|
|||
import './staff-settings'
|
||||
23
plugins/staff-settings/index.ts
Normal file
23
plugins/staff-settings/index.ts
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
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 { registerPlugin } from '@revenge-mod/plugins/_'
|
||||
|
||||
registerPlugin(
|
||||
{
|
||||
id: 'revenge.staff-settings',
|
||||
name: 'Staff Settings',
|
||||
description: "Allows accessing Discord's Staff Settings.",
|
||||
icon: 'StaffBadgeIcon',
|
||||
},
|
||||
{
|
||||
init: async ({ cleanup }) => {
|
||||
const UserStoreUtils = await findModule(byProps('isStaffEnv'))
|
||||
cleanup(after(UserStoreUtils, 'isStaffEnv', () => true))
|
||||
},
|
||||
},
|
||||
PluginFlags.Internal | PluginFlags.Enabled,
|
||||
)
|
||||
Loading…
Add table
Reference in a new issue