mirror of
https://github.com/roleypoly/roleypoly-v1.git
synced 2025-06-15 01:49:10 +00:00
fix unsafe roles being usable, begin work on role/server editor
This commit is contained in:
parent
d1f556b0f0
commit
bd15a812e5
20 changed files with 343 additions and 92 deletions
|
@ -15,7 +15,10 @@ class DiscordService extends Service {
|
|||
this.client = new discord.Client()
|
||||
|
||||
this.startBot()
|
||||
}
|
||||
|
||||
ownGm (server) {
|
||||
return this.gm(server, this.client.user.id)
|
||||
}
|
||||
|
||||
async startBot () {
|
||||
|
@ -45,6 +48,11 @@ class DiscordService extends Service {
|
|||
}
|
||||
}
|
||||
|
||||
safeRole (server, role) {
|
||||
const r = this.getRoles(server).get(role)
|
||||
return r.editable && !r.hasPermission('MANAGE_ROLES', false, true)
|
||||
}
|
||||
|
||||
// oauth step 2 flow, grab the auth token via code
|
||||
async getAuthToken (code) {
|
||||
const url = 'https://discordapp.com/api/oauth2/token'
|
||||
|
|
|
@ -42,13 +42,14 @@ class PresentationService extends Service {
|
|||
|
||||
async rolesByServer (server) {
|
||||
return server.roles
|
||||
.filter(r => r.id !== server.id) // get rid of @everyone
|
||||
.map(r => ({
|
||||
id: r.id,
|
||||
color: r.color,
|
||||
name: r.name,
|
||||
position: r.position
|
||||
}))
|
||||
.filter(r => r.id !== server.id) // get rid of @everyone
|
||||
.map(r => ({
|
||||
id: r.id,
|
||||
color: r.color,
|
||||
name: r.name,
|
||||
position: r.position,
|
||||
safe: this.discord.safeRole(server.id, r.id)
|
||||
}))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue