mirror of
https://github.com/roleypoly/roleypoly-v1.git
synced 2025-04-24 19:59:12 +00:00
fix(DiscordService): add catch for ownerid being null
This commit is contained in:
parent
4ffd5014df
commit
535719b816
1 changed files with 7 additions and 1 deletions
|
@ -124,13 +124,19 @@ class DiscordService extends Service {
|
|||
}
|
||||
}
|
||||
|
||||
if (!!guild.ownerid) {
|
||||
this.log.warn('Owner ID is null!', guild)
|
||||
}
|
||||
|
||||
const isOwner = !!guild.ownerid && guild.ownerid === gm.user.id
|
||||
|
||||
const matchFor = permissionInt =>
|
||||
!!gm.rolesList
|
||||
.map(id => guildRoles.find(role => role.id === id))
|
||||
.filter(x => !!x)
|
||||
.find(role => (role.permissions & permissionInt) === permissionInt)
|
||||
|
||||
const isAdmin = guild.ownerid === gm.user.id || matchFor(0x00000008)
|
||||
const isAdmin = isOwner || matchFor(0x00000008)
|
||||
const canManageRoles = isAdmin || matchFor(0x10000000)
|
||||
|
||||
return {
|
||||
|
|
Loading…
Add table
Reference in a new issue