Skip to content

Commit

Permalink
Fix deprecated query syntax in PermissionManager
Browse files Browse the repository at this point in the history
  • Loading branch information
SunflowerFuchs committed Aug 24, 2022
1 parent c682505 commit 4b79815
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/Helpers/PermissionManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,12 +136,14 @@ protected function memberHasPermission(Snowflake $guildId, GuildMember $guildMem
}

// Check if the user has been given the permission directly
$hasPermission = $this->db->count(self::TABLE_MEMBERS, null, [
self::COL_GUILD_ID => $guildId->toInt(),
self::COL_USER_ID => $guildMember->getUser()->getId()->toInt(),
self::COL_PERMISSION => $permission
]);
if ($hasPermission === 1) {
$hasPermission = $this->db
->table(self::TABLE_MEMBERS)
->where(self::COL_GUILD_ID, '=', $guildId->toInt())
->where(self::COL_USER_ID, '=', $guildMember->getUser()->getId()->toInt())
->where(self::COL_PERMISSION, '=', $permission)
->count() === 1;

if ($hasPermission) {
return true;
}

Expand Down

0 comments on commit 4b79815

Please sign in to comment.