mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-03-18 06:51:51 +00:00
canActOn: add option to allow same level
This commit is contained in:
parent
63b3519ac4
commit
c1b7967d10
1 changed files with 4 additions and 4 deletions
|
@ -71,14 +71,14 @@ export class ZeppelinPlugin<TConfig extends {} = IBasePluginConfig> extends Plug
|
||||||
throw new PluginRuntimeError(message, this.runtimePluginName, this.guildId);
|
throw new PluginRuntimeError(message, this.runtimePluginName, this.guildId);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected canActOn(member1, member2) {
|
protected canActOn(member1: Member, member2: Member, allowSameLevel = false) {
|
||||||
if (member1.id === member2.id || member2.id === this.bot.user.id) {
|
if (member2.id === this.bot.user.id) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const ourLevel = this.getMemberLevel(member1);
|
const ourLevel = this.getMemberLevel(member1);
|
||||||
const memberLevel = this.getMemberLevel(member2);
|
const memberLevel = this.getMemberLevel(member2);
|
||||||
return ourLevel > memberLevel;
|
return allowSameLevel ? ourLevel >= memberLevel : ourLevel > memberLevel;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Reference in a new issue