mirror of
https://github.com/kirameki-cafe/Yumi.git
synced 2026-09-13 18:59:19 +00:00
Added permission check for setPrefix
This commit is contained in:
+13
-1
@@ -1,4 +1,4 @@
|
||||
import { Message, Interaction, CommandInteraction } from "discord.js";
|
||||
import { Message, Interaction, CommandInteraction, Permissions } from "discord.js";
|
||||
import { makeInfoEmbed, makeErrorEmbed, makeSuccessEmbed, makeProcessingEmbed, sendMessageOrInteractionResponse, sendReply } from "../utils/DiscordMessage";
|
||||
import DiscordProvider from "../providers/Discord";
|
||||
import {registerAllGuildsCommands, unregisterAllGuildsCommands} from "../utils/DiscordInteraction";
|
||||
@@ -91,6 +91,18 @@ export default class Settings {
|
||||
const funct = {
|
||||
setPrefix: async(data: Message | Interaction) => {
|
||||
|
||||
if(data === null || !data.guildId || data.member === null || data.guild === null) return;
|
||||
|
||||
if(data instanceof Message) {
|
||||
if (!data.member.permissions.has([Permissions.FLAGS.ADMINISTRATOR]))
|
||||
return await sendMessageOrInteractionResponse(data, { embeds: [EMBEDS.NO_PERMISSION(data)] });
|
||||
}
|
||||
else if(isSlashCommand) {
|
||||
if(!data.guild.members.cache.get(data.user.id)?.permissions.has([Permissions.FLAGS.ADMINISTRATOR]))
|
||||
return await sendMessageOrInteractionResponse(data, { embeds: [EMBEDS.NO_PERMISSION(data)] });
|
||||
}
|
||||
|
||||
|
||||
let newPrefix: string | undefined;
|
||||
if(data instanceof Message) {
|
||||
let _name: string;
|
||||
|
||||
Reference in New Issue
Block a user