This commit is contained in:
Katalina / stardust 2018-01-06 17:40:52 -06:00
parent 7dd7c170b4
commit 86a222fb98
20 changed files with 291 additions and 46 deletions

View file

@ -137,7 +137,7 @@ class DiscordService extends Service {
// returns the bot join url with MANAGE_ROLES permission
// MANAGE_ROLES is the only permission we really need.
getBotJoinUrl () {
return `https://discordapp.com/oauth2/authorize?client_id=${this.clientId}&scope=bot&permissions=268435456&redirect_uri=${this.botCallback}`
return `https://discordapp.com/oauth2/authorize?client_id=${this.clientId}&scope=bot&permissions=268435456`
}
mentionResponse (message) {
@ -215,6 +215,7 @@ class DiscordService extends Service {
}
}
}
}
module.exports = DiscordService

View file

@ -25,12 +25,12 @@ class PresentationService extends Service {
async presentableServers (collection, userId) {
return collection.array().areduce(async (acc, server) => {
const gm = server.members.get(userId)
acc.push(await this.presentableServer(server, gm))
acc.push(await this.presentableServer(server, gm, { incRoles: false }))
return acc
})
}
async presentableServer (server, gm) {
async presentableServer (server, gm, { incRoles = true } = {}) {
const sd = await this.ctx.server.get(server.id)
return {
@ -45,7 +45,7 @@ class PresentationService extends Service {
ownerID: server.ownerID,
icon: server.icon
},
roles: (await this.rolesByServer(server, sd)).map(r => ({ ...r, selected: gm.roles.has(r.id) })),
roles: (incRoles) ? (await this.rolesByServer(server, sd)).map(r => ({ ...r, selected: gm.roles.has(r.id) })) : [],
message: sd.message,
categories: sd.categories,
perms: this.discord.getPermissions(gm)