mirror of
https://github.com/NovaGM/ModuleBuilder.git
synced 2024-08-15 00:23:33 +00:00
[PCCompat > Entities] Global: Add api.commands.registerCommand
This commit is contained in:
parent
a597534581
commit
d95f20db3f
1 changed files with 20 additions and 0 deletions
|
@ -1,3 +1,23 @@
|
|||
// Also set Powercord global var stuff here since entities import is needed to use Plugin (which every PC plugin uses)
|
||||
|
||||
window.powercord = {
|
||||
api: {
|
||||
commands: {
|
||||
registerCommand: ({ command, description, _usage, executor }) => {
|
||||
goosemodScope.patcher.commands.add(command, description,
|
||||
( { message: [ { text } ] } ) => {
|
||||
const out = executor(text.split(' ')); // Run original executor func
|
||||
|
||||
if (!out.send) return; // PC impl. sends internal message when out.send === true, so we also do the same via our previous Patcher API function, seen below
|
||||
goosemodScope.patcher.internalMessage(out.result);
|
||||
}, [
|
||||
{ type: 3, required: false, name: 'args', description: 'Arguments for PC command' } // Argument for any string for compat. with PC's classical commands
|
||||
])
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
export class Plugin {
|
||||
constructor() {
|
||||
|
||||
|
|
Loading…
Reference in a new issue