mirror of
https://github.com/roleypoly/roleypoly-v1.git
synced 2025-06-15 01:49:10 +00:00
fake guildmember for root users
This commit is contained in:
parent
96d91caba0
commit
8599929531
2 changed files with 49 additions and 1 deletions
|
@ -27,6 +27,14 @@ class DiscordService extends Service {
|
|||
return this.gm(server, this.client.user.id)
|
||||
}
|
||||
|
||||
fakeGm({id = 0, nickname = '[none]', displayHexColor = '#ffffff'}) {
|
||||
return { id, nickname, displayHexColor, __faked: true, roles: { has() {return false} } }
|
||||
}
|
||||
|
||||
isRoot(id) {
|
||||
return this.rootUsers.has(id)
|
||||
}
|
||||
|
||||
async startBot () {
|
||||
await this.client.login(this.botToken)
|
||||
|
||||
|
@ -55,6 +63,13 @@ class DiscordService extends Service {
|
|||
}
|
||||
|
||||
getPermissions (gm) {
|
||||
if (this.isRoot(gm.id)) {
|
||||
return {
|
||||
isAdmin: true,
|
||||
canManageRoles: true
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
isAdmin: gm.permissions.hasPermission('ADMINISTRATOR'),
|
||||
canManageRoles: gm.permissions.hasPermission('MANAGE_ROLES', false, true)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue