mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-03-15 05:41:51 +00:00
Add a standardized way of checking for bot owners in global plugins
This commit is contained in:
parent
6b46346a80
commit
307f95e0f4
2 changed files with 6 additions and 9 deletions
|
@ -46,11 +46,7 @@ export class BotControlPlugin extends GlobalZeppelinPlugin<TConfigSchema> {
|
|||
}
|
||||
|
||||
protected getMemberLevel(member) {
|
||||
if (this.getConfig().owners.includes(member.id)) {
|
||||
return 100;
|
||||
}
|
||||
|
||||
return 0;
|
||||
return this.isOwner(member.id) ? 100 : 0;
|
||||
}
|
||||
|
||||
async onLoad() {
|
||||
|
@ -70,10 +66,6 @@ export class BotControlPlugin extends GlobalZeppelinPlugin<TConfigSchema> {
|
|||
}
|
||||
}
|
||||
|
||||
isOwner(userId) {
|
||||
return this.getConfig().owners.includes(userId);
|
||||
}
|
||||
|
||||
@d.command("bot_full_update")
|
||||
@d.permission("can_use")
|
||||
async fullUpdateCmd(msg: Message) {
|
||||
|
|
|
@ -110,4 +110,9 @@ export class GlobalZeppelinPlugin<TConfig extends {} = IBasePluginConfig> extend
|
|||
const mergedOptions = this.getMergedOptions(); // This implicitly also validates the config
|
||||
return super.runLoad();
|
||||
}
|
||||
|
||||
protected isOwner(userId) {
|
||||
const owners = this.knub.getGlobalConfig().owners || [];
|
||||
return owners.includes(userId);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue