Skip to content

Commit

Permalink
Pruning permission (#1206)
Browse files Browse the repository at this point in the history
* Permissions Change for Pruning

Starting on March 15, 2024, the Get Guild Prune Count and Begin Guild Prune endpoints will require the MANAGE_GUILD permission alongside the existing KICK_MEMBERS permission.

* Update src/Discord/Parts/Guild/Guild.php

Co-authored-by: SQKo <87897282+SQKo@users.noreply.github.com>

* Update src/Discord/Parts/Guild/Guild.php

Co-authored-by: SQKo <87897282+SQKo@users.noreply.github.com>

---------

Co-authored-by: SQKo <87897282+SQKo@users.noreply.github.com>
  • Loading branch information
key2peace and SQKo authored Mar 15, 2024
1 parent 89ae6b1 commit ac16fdf
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Discord/Parts/Guild/Guild.php
Original file line number Diff line number Diff line change
Expand Up @@ -1225,7 +1225,7 @@ public function getPruneCount(array $options = []): ExtendedPromiseInterface
$options = $resolver->resolve($options);

$botperms = $this->getBotPermissions();
if ($botperms && ! $botperms->kick_members) {
if ($botperms && ! ($botperms->kick_members && $botperms->manage_guild)) {
return reject(new NoPermissionsException("You do not have permission to get prune count in the guild {$this->id}."));
}

Expand Down Expand Up @@ -1283,7 +1283,7 @@ public function beginPrune(array $options = [], ?string $reason = null): Extende
$options = $resolver->resolve($options);

$botperms = $this->getBotPermissions();
if ($botperms && ! $botperms->kick_members) {
if ($botperms && ! ($botperms->kick_members && $botperms->manage_guild)) {
return reject(new NoPermissionsException("You do not have permission to prune members in the guild {$this->id}."));
}

Expand Down

0 comments on commit ac16fdf

Please sign in to comment.