mirror of
https://github.com/aydenjahola/discord-multipurpose-bot.git
synced 2024-11-25 10:15:55 +00:00
mod commands: update mod commands to use the PermissionFlagsBits rather than specifying manually
This commit is contained in:
parent
afd2c9f6a4
commit
c06a7cd73e
3 changed files with 20 additions and 6 deletions
|
@ -1,4 +1,4 @@
|
||||||
const { SlashCommandBuilder } = require("discord.js");
|
const { SlashCommandBuilder, PermissionFlagsBits } = require("discord.js");
|
||||||
const Leaderboard = require("../../models/Leaderboard");
|
const Leaderboard = require("../../models/Leaderboard");
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
@ -10,7 +10,9 @@ module.exports = {
|
||||||
async execute(interaction) {
|
async execute(interaction) {
|
||||||
try {
|
try {
|
||||||
// Check if the user has the Manage Server permission
|
// Check if the user has the Manage Server permission
|
||||||
if (!interaction.member.permissions.has("ManageGuild")) {
|
if (
|
||||||
|
!interaction.member.permissions.has(PermissionFlagsBits.ManageGuild)
|
||||||
|
) {
|
||||||
await interaction.reply({
|
await interaction.reply({
|
||||||
content: "You do not have permission to use this command!",
|
content: "You do not have permission to use this command!",
|
||||||
ephemeral: true,
|
ephemeral: true,
|
||||||
|
|
|
@ -1,4 +1,8 @@
|
||||||
const { SlashCommandBuilder, EmbedBuilder } = require("discord.js");
|
const {
|
||||||
|
SlashCommandBuilder,
|
||||||
|
EmbedBuilder,
|
||||||
|
PermissionFlagsBits,
|
||||||
|
} = require("discord.js");
|
||||||
const KickedUser = require("../../models/KickedUser");
|
const KickedUser = require("../../models/KickedUser");
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
@ -22,7 +26,9 @@ module.exports = {
|
||||||
async execute(interaction) {
|
async execute(interaction) {
|
||||||
try {
|
try {
|
||||||
// Check if the user has the Kick Members permission
|
// Check if the user has the Kick Members permission
|
||||||
if (!interaction.member.permissions.has("KickMembers")) {
|
if (
|
||||||
|
!interaction.member.permissions.has(PermissionFlagsBits.KickMembers)
|
||||||
|
) {
|
||||||
await interaction.reply({
|
await interaction.reply({
|
||||||
content: "You do not have permission to use this command!",
|
content: "You do not have permission to use this command!",
|
||||||
ephemeral: true,
|
ephemeral: true,
|
||||||
|
|
|
@ -1,4 +1,8 @@
|
||||||
const { SlashCommandBuilder, EmbedBuilder } = require("discord.js");
|
const {
|
||||||
|
SlashCommandBuilder,
|
||||||
|
EmbedBuilder,
|
||||||
|
PermissionFlagsBits,
|
||||||
|
} = require("discord.js");
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
data: new SlashCommandBuilder()
|
data: new SlashCommandBuilder()
|
||||||
|
@ -27,7 +31,9 @@ module.exports = {
|
||||||
async execute(interaction) {
|
async execute(interaction) {
|
||||||
try {
|
try {
|
||||||
// Check if the user has the Manage Messages permission
|
// Check if the user has the Manage Messages permission
|
||||||
if (!interaction.member.permissions.has("ManageMessages")) {
|
if (
|
||||||
|
!interaction.member.permissions.has(PermissionFlagsBits.ManageMessages)
|
||||||
|
) {
|
||||||
await interaction.reply({
|
await interaction.reply({
|
||||||
content: "You do not have permission to use this command!",
|
content: "You do not have permission to use this command!",
|
||||||
ephemeral: true,
|
ephemeral: true,
|
||||||
|
|
Loading…
Reference in a new issue