feat: add key methods

This commit is contained in:
2026-01-13 18:37:11 -03:00
parent cfae674cb4
commit 889b86b019
+16
View File
@@ -99,6 +99,22 @@ export class CommandManager {
return this.getAll().filter((cmd) => !!cmd.name);
}
public getGuildKeys(): Record<string, unknown> {
return this.mergeKeys('guild_keys');
}
public getUserKeys(): Record<string, unknown> {
return this.mergeKeys('user_keys');
}
private mergeKeys(
keyType: 'guild_keys' | 'user_keys'
): Record<string, unknown> {
return this.getAll()
.flatMap((cmd) => (cmd[keyType] ? [cmd[keyType]] : []))
.reduce((acc, val) => Object.assign(acc, val), {});
}
/*
internal
*/