Commit 3981d66b authored by Imran Hussain's avatar Imran Hussain

Close #8: Startin using server specifc member and staff groups

parent 189b51e6
Pipeline #673 passed with stages
in 1 minute and 22 seconds
/* global process */
const apis = JSON.parse(process.env.SOCS);
const settings = JSON.parse(process.env.SOCS);
module.exports = {
name: 'verify',
description: 'Verify your society membership status',
......@@ -84,7 +84,7 @@ module.exports = {
console.log('Sucess! ' + message.author.username + ' is in ' + soc);
const targetGuild = client.guilds.find((val) => val.name === soc);
const targetRole = targetGuild.roles.find((val) => val.name === process.env.MEMBER_GROUP );
const targetRole = targetGuild.roles.find((val) => val.name === settings[soc].member_group );
targetGuild.fetchMember(message.author)
.then( (discordMember) => {
discordMember.addRole(targetRole);
......@@ -120,7 +120,7 @@ module.exports = {
console.log('Verify ' + message.author.username + ' is in ' + soc);
if (apis[soc] === undefined) {
if (settings[soc] === undefined) {
console.error('Unsupported society!');
message.reply('That society doesn\'t like me :(');
return;
......@@ -139,9 +139,9 @@ module.exports = {
let apiData;
if (process.env.DEV_MODE === 'true') {
apiData = getTestAPIData(apis[soc].apikey, apis[soc].orgid);
apiData = getTestAPIData(settings[soc].apikey, settings[soc].orgid);
} else {
apiData = await getAPIData(apis[soc].apikey, apis[soc].orgid);
apiData = await getAPIData(settings[soc].apikey, settings[soc].orgid);
}
verifyMembership(apiData);
......
/* global process */
const Discord = require('discord.js');
const cooldowns = new Discord.Collection();
const settings = JSON.parse(process.env.SOCS);
module.exports = (client, message) => {
// let mw people know that they are on discord
......@@ -27,7 +28,7 @@ module.exports = (client, message) => {
return;
}
if (command.staffOnly && !message.member.roles.find( (r) => r.name === process.env.STAFF_GROUP)) {
if (command.staffOnly && !message.member.roles.find( (r) => r.name === settings[message.member.guild.name].staff_group)) {
console.log(message.guild.name + ': ' + message.author.username + ' tried to use the Staff command ' + message);
return;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment