diff options
-rw-r--r-- | src/lib/extensions/discord-akairo/BushClientUtil.ts | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/lib/extensions/discord-akairo/BushClientUtil.ts b/src/lib/extensions/discord-akairo/BushClientUtil.ts index 56e2c13..f759d22 100644 --- a/src/lib/extensions/discord-akairo/BushClientUtil.ts +++ b/src/lib/extensions/discord-akairo/BushClientUtil.ts @@ -1448,10 +1448,21 @@ export class BushClientUtil extends ClientUtil { (i == 0 || p !== arr[i - 1]) && //not overriding in this prototype props.indexOf(p) === -1 //not overridden in a child ); - l.forEach((p) => console.debug(Object.getOwnPropertyDescriptor(obj, p))); + const reg = /\(([\s\S]*?)\)/; props = props.concat( - l.map((p) => (obj[p] && obj[p][Symbol.toStringTag] === 'AsyncFunction' ? `async ${p}();` : `${p}();`)) + l.map( + (p) => + `${obj[p] && obj[p][Symbol.toStringTag] === 'AsyncFunction' ? 'async ' : ''}function ${p}(${ + reg.exec(obj[p].toString())?.[1] + ? reg + .exec(obj[p].toString())?.[1] + .split(', ') + .map((arg) => arg.split('=')[0].trim()) + .join(', ') + : '' + });` + ) ); } while ( (obj = Object.getPrototypeOf(obj)) && //walk-up the prototype chain |