generated from nhcarrigan/template
fix: permission check
This commit is contained in:
@@ -4,7 +4,12 @@
|
|||||||
* @author Naomi Carrigan
|
* @author Naomi Carrigan
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { MessageFlags, type Interaction, ChannelType } from "discord.js";
|
import {
|
||||||
|
MessageFlags,
|
||||||
|
type Interaction,
|
||||||
|
ChannelType,
|
||||||
|
PermissionFlagsBits,
|
||||||
|
} from "discord.js";
|
||||||
import { about } from "../components/about.js";
|
import { about } from "../components/about.js";
|
||||||
import type { Umbrelle } from "../interfaces/umbrelle.js";
|
import type { Umbrelle } from "../interfaces/umbrelle.js";
|
||||||
|
|
||||||
@@ -24,7 +29,7 @@ export const handleInteraction = async(
|
|||||||
await interaction.deferReply({
|
await interaction.deferReply({
|
||||||
flags: [ MessageFlags.Ephemeral ],
|
flags: [ MessageFlags.Ephemeral ],
|
||||||
});
|
});
|
||||||
const { commandName, options, guild } = interaction;
|
const { commandName, options, guild, member } = interaction;
|
||||||
if (commandName === "about") {
|
if (commandName === "about") {
|
||||||
await interaction.editReply({
|
await interaction.editReply({
|
||||||
components: about,
|
components: about,
|
||||||
@@ -33,6 +38,12 @@ export const handleInteraction = async(
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (commandName === "honeypot") {
|
if (commandName === "honeypot") {
|
||||||
|
if (!member.permissions.has(PermissionFlagsBits.ManageGuild)) {
|
||||||
|
await interaction.editReply(
|
||||||
|
"You do not have permission to set a honeypot channel.",
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
const channel
|
const channel
|
||||||
= options.getChannel("channel", true, [ ChannelType.GuildText ]);
|
= options.getChannel("channel", true, [ ChannelType.GuildText ]);
|
||||||
await umbrelle.db.honeypots.upsert({
|
await umbrelle.db.honeypots.upsert({
|
||||||
|
|||||||
Reference in New Issue
Block a user