diff options
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/extensions/discord-akairo/BushClientUtil.ts | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/lib/extensions/discord-akairo/BushClientUtil.ts b/src/lib/extensions/discord-akairo/BushClientUtil.ts index 2a01f6a..4f9f09b 100644 --- a/src/lib/extensions/discord-akairo/BushClientUtil.ts +++ b/src/lib/extensions/discord-akairo/BushClientUtil.ts @@ -1371,4 +1371,31 @@ export class BushClientUtil extends ClientUtil { public async sleep(s: number): Promise<unknown> { return new Promise((resolve) => setTimeout(resolve, s * 1000)); } + + // modified from https://stackoverflow.com/questions/31054910/get-functions-methods-of-a-class + // answer by Bruno Grieder + // public getMethods(obj: any): string { + // let props = []; + + // do { + // const l = Object.getOwnPropertyNames(obj) + // .concat(Object.getOwnPropertySymbols(obj).map((s) => s.toString())) + // .sort() + // .filter( + // (p, i, arr) => + // typeof obj[p] === 'function' && //only the methods + // p !== 'constructor' && //not the constructor + // (i == 0 || p !== arr[i - 1]) && //not overriding in this prototype + // props.indexOf(p) === -1 //not overridden in a child + // ); + // props = props.concat( + // l /* .map((p) => (obj[p] && obj[p][Symbol.toStringTag] === 'AsyncFunction' ? 'async ' : '' + p + '();')) */ + // ); + // } while ( + // (obj = Object.getPrototypeOf(obj)) && //walk-up the prototype chain + // Object.getPrototypeOf(obj) //not the the Object prototype methods (hasOwnProperty, etc...) + // ); + + // return props.join('\n'); + // } } |