From 5be326d56ae9127c2d547917efe47a1a0a298685 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Gro=C3=9F?= Date: Thu, 29 Sep 2022 11:23:15 +0200 Subject: [PATCH] Added permission levels to all commands --- commands/burn.js | 1 + commands/collection.js | 1 + commands/cooldowns.js | 1 + commands/debugRendering.js | 2 +- commands/drop.js | 2 +- commands/editprofile.js | 1 + commands/profile.js | 1 + commands/register.js | 1 + commands/stats.js | 1 + commands/userlist.js | 1 + commands/view.js | 1 + 11 files changed, 11 insertions(+), 2 deletions(-) diff --git a/commands/burn.js b/commands/burn.js index 8158c57..8e0fe83 100644 --- a/commands/burn.js +++ b/commands/burn.js @@ -17,6 +17,7 @@ module.exports = { .setRequired(true) .setAutocomplete(true) ), + permissionLevel: 0, async execute(interaction) { await interaction.deferReply(); diff --git a/commands/collection.js b/commands/collection.js index d325051..217e57a 100644 --- a/commands/collection.js +++ b/commands/collection.js @@ -9,6 +9,7 @@ module.exports = { data: new SlashCommandBuilder() .setName("collection") .setDescription("List all cards in your collection"), + permissionLevel: 0, async execute(interaction) { let user = await UserUtils.getUserByDiscordId(interaction.member.id); let offset = 0; diff --git a/commands/cooldowns.js b/commands/cooldowns.js index 748ea22..8b357b6 100644 --- a/commands/cooldowns.js +++ b/commands/cooldowns.js @@ -7,6 +7,7 @@ module.exports = { data: new SlashCommandBuilder() .setName("cooldowns") .setDescription("List cooldowns"), + permissionLevel: 0, async execute(interaction) { //fetch the user given the userID and include his cards const user = await UserUtils.getUserByDiscordId(interaction.member.id); diff --git a/commands/debugRendering.js b/commands/debugRendering.js index 8cf30a1..9e61255 100644 --- a/commands/debugRendering.js +++ b/commands/debugRendering.js @@ -4,7 +4,7 @@ module.exports = { data: new SlashCommandBuilder() .setName("debugrendering") .setDescription("Debug rendering"), - permissionLevel: 1, + permissionLevel: 2, async execute(interaction) { const image = await sharp({ diff --git a/commands/drop.js b/commands/drop.js index cca6bfb..f68a3d3 100644 --- a/commands/drop.js +++ b/commands/drop.js @@ -9,7 +9,7 @@ module.exports = { data: new SlashCommandBuilder() .setName("drop") .setDescription("Drop a card"), - + permissionLevel: 0, async execute(interaction) { await interaction.deferReply(); const user = await UserUtils.getUserByDiscordId(interaction.member.id); diff --git a/commands/editprofile.js b/commands/editprofile.js index 658c9e3..7331d12 100644 --- a/commands/editprofile.js +++ b/commands/editprofile.js @@ -9,6 +9,7 @@ module.exports = { data: new SlashCommandBuilder() .setName("editprofile") .setDescription("Edit your profile"), + permissionLevel: 0, async execute(interaction) { let user = await UserUtils.getUserByDiscordId(interaction.member.id); diff --git a/commands/profile.js b/commands/profile.js index 3451185..eefe848 100644 --- a/commands/profile.js +++ b/commands/profile.js @@ -19,6 +19,7 @@ module.exports = { .setDescription("View someone else's profile") .setRequired(false) ), + permissionLevel: 0, async execute(interaction) { await interaction.reply({ files:[ 'https://cdn.discordapp.com/attachments/856904078754971658/1019009533470842930/rendering-placeholder.gif']}); diff --git a/commands/register.js b/commands/register.js index fc79c57..ea4e482 100644 --- a/commands/register.js +++ b/commands/register.js @@ -6,6 +6,7 @@ module.exports = { data: new SlashCommandBuilder() .setName("register") .setDescription("Register yourself"), + permissionLevel: 0, async execute(interaction) { let user = await User.findOne({ where: { diff --git a/commands/stats.js b/commands/stats.js index 6c16547..e77328c 100644 --- a/commands/stats.js +++ b/commands/stats.js @@ -11,6 +11,7 @@ module.exports = { .setDescription("View someone else's stats") .setRequired(false) ), + permissionLevel: 0, async execute(interaction) { await interaction.deferReply(); let discordUser = interaction.options.getUser("user") ? interaction.options.getUser("user") : interaction.member.user; diff --git a/commands/userlist.js b/commands/userlist.js index 07688eb..b288b1f 100644 --- a/commands/userlist.js +++ b/commands/userlist.js @@ -6,6 +6,7 @@ module.exports = { data: new SlashCommandBuilder() .setName("userlist") .setDescription("List all users"), + permissionLevel: 2, async execute(interaction) { let users = await User.findAll(); let userList = ""; diff --git a/commands/view.js b/commands/view.js index b1ed58d..f2af0d4 100644 --- a/commands/view.js +++ b/commands/view.js @@ -28,6 +28,7 @@ module.exports = { .setRequired(true) .setAutocomplete(true) ), + permissionLevel: 0, async execute(interaction) { await interaction.deferReply();