[PCCompat > Global] api.commands.registerCommand: await executor incase async

This commit is contained in:
Ducko 2021-04-04 22:17:50 +01:00 committed by Keanu
parent 5b1f81ae60
commit b658064804
Signed by: keanucode
GPG Key ID: A7431C0D513CA93B
1 changed files with 4 additions and 2 deletions

View File

@ -7,8 +7,10 @@ export const powercord = {
// TODO: implement alias // TODO: implement alias
goosemodScope.patcher.commands.add(command, description, goosemodScope.patcher.commands.add(command, description,
( { args: [ { text } ] } ) => { async ( { args: [ { text } ] } ) => {
const out = executor(text.split(' ')); // Run original executor func const out = await executor(text.split(' ')); // Run original executor func (await incase it's an async function)
console.log(out);
if (!out.send) return goosemodScope.patcher.internalMessage(out.result); // PC impl. sends internal message when out.send === false, so we also do the same via our previous Patcher API function if (!out.send) return goosemodScope.patcher.internalMessage(out.result); // PC impl. sends internal message when out.send === false, so we also do the same via our previous Patcher API function
// When send is true, we send it as a message via returning obj with content // When send is true, we send it as a message via returning obj with content