mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-03-18 15:00:00 +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);
|
||||
}
|
||||
|
||||
protected canActOn(member1, member2) {
|
||||
if (member1.id === member2.id || member2.id === this.bot.user.id) {
|
||||
protected canActOn(member1: Member, member2: Member, allowSameLevel = false) {
|
||||
if (member2.id === this.bot.user.id) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const ourLevel = this.getMemberLevel(member1);
|
||||
const memberLevel = this.getMemberLevel(member2);
|
||||
return ourLevel > memberLevel;
|
||||
return allowSameLevel ? ourLevel >= memberLevel : ourLevel > memberLevel;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Reference in a new issue