Add command permission checks

Level 0: Every user - Public commands
Level 1: Guild owners or members with respective admin role - Elevated guild commands
Level 2: Global admins - Every command including levels below
This commit is contained in:
2022-08-19 19:18:01 +02:00
parent 6a7e3f6647
commit eb4ffae173
8 changed files with 147 additions and 4 deletions

23
util/guilds.js Normal file
View File

@@ -0,0 +1,23 @@
const { Guild } = require("../models");
module.exports = {
name: "GuildUtils",
getProperty: async function(guildId, property) {
let guild = await Guild.findOne({
where: {
guildId: guildId
}
});
return property ? guild[property] : guild;
},
setProperty: async function(guildId, property, value) {
let guild = await Guild.findOne({
where: {
guildId: guildId
}
});
guild[property] = value;
await guild.save();
}
}