[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

View file

@ -7,8 +7,10 @@ export const powercord = {
// TODO: implement alias
goosemodScope.patcher.commands.add(command, description,
( { args: [ { text } ] } ) => {
const out = executor(text.split(' ')); // Run original executor func
async ( { args: [ { text } ] } ) => {
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
// When send is true, we send it as a message via returning obj with content