From d8dd8f4e70f42beb6b41a359adcebe077e7a6ccd Mon Sep 17 00:00:00 2001 From: Taken Date: Mon, 9 Sep 2024 22:11:51 +0200 Subject: [PATCH] Added contexts for slashcommands --- src/commands/anime.ts | 5 +++-- src/commands/ban.ts | 5 +++-- src/commands/botinfo.ts | 5 +++-- src/commands/check.ts | 5 +++-- src/commands/clear.ts | 5 +++-- src/commands/config.ts | 5 +++-- src/commands/counting.ts | 5 +++-- src/commands/find.ts | 5 +++-- src/commands/forceunverify.ts | 5 +++-- src/commands/forceupdate.ts | 5 +++-- src/commands/forceverify.ts | 5 +++-- src/commands/guild.ts | 5 +++-- src/commands/help.ts | 5 +++-- src/commands/instructions.ts | 5 +++-- src/commands/kick.ts | 5 +++-- src/commands/music.ts | 5 +++-- src/commands/ping.ts | 5 +++-- src/commands/pp.ts | 5 +++-- src/commands/remove.ts | 5 +++-- src/commands/reqs.ts | 5 +++-- src/commands/send.ts | 5 +++-- src/commands/setnick.ts | 5 +++-- src/commands/setup.ts | 14 ++++++++++++-- src/commands/slowmode.ts | 5 +++-- src/commands/staff.ts | 5 +++-- src/commands/timeout.ts | 5 +++-- src/commands/unban.ts | 5 +++-- src/commands/update.ts | 5 +++-- src/commands/uuid.ts | 5 +++-- src/commands/verify.ts | 5 +++-- src/commands/whoami.ts | 5 +++-- src/commands/whois.ts | 5 +++-- 32 files changed, 105 insertions(+), 64 deletions(-) diff --git a/src/commands/anime.ts b/src/commands/anime.ts index c7ac1c4..98bc70f 100644 --- a/src/commands/anime.ts +++ b/src/commands/anime.ts @@ -1,6 +1,6 @@ import { anilist } from "anilist" import { devMessage, embedColor } from "config/options.js" -import { SlashCommandBuilder } from "discord.js" +import { InteractionContextType, SlashCommandBuilder } from "discord.js" import { ICommand } from "interfaces" export default { @@ -17,7 +17,8 @@ export default { .setName("query") .setDescription("The anime to search for") .setRequired(true) - ), + ) + .setContexts(InteractionContextType.Guild), async execute({ interaction }) { await interaction.deferReply() diff --git a/src/commands/ban.ts b/src/commands/ban.ts index 6b14b51..a7932f6 100644 --- a/src/commands/ban.ts +++ b/src/commands/ban.ts @@ -1,6 +1,6 @@ import { devMessage, embedColor } from "config/options.js" import { admin, helper } from "config/roles.js" -import { GuildMember, PermissionFlagsBits, SlashCommandBuilder, userMention } from "discord.js" +import { GuildMember, InteractionContextType, PermissionFlagsBits, SlashCommandBuilder, userMention } from "discord.js" import { ICommand } from "interfaces" import logToChannel from "utils/functions/logtochannel.js" @@ -38,7 +38,8 @@ export default { { name: "7 days", value: 7 } ) ) - .setDefaultMemberPermissions(PermissionFlagsBits.BanMembers), + .setDefaultMemberPermissions(PermissionFlagsBits.BanMembers) + .setContexts(InteractionContextType.Guild), async execute({ interaction }) { await interaction.deferReply() diff --git a/src/commands/botinfo.ts b/src/commands/botinfo.ts index 4a6acda..59ae4b6 100644 --- a/src/commands/botinfo.ts +++ b/src/commands/botinfo.ts @@ -1,6 +1,6 @@ import { execSync } from "child_process" import { devMessage, embedColor } from "config/options.js" -import { SlashCommandBuilder } from "discord.js" +import { InteractionContextType, SlashCommandBuilder } from "discord.js" import { ICommand } from "interfaces" import { createRequire } from "node:module" import os from "os" @@ -17,7 +17,8 @@ export default { data: new SlashCommandBuilder() .setName("botinfo") - .setDescription("Get information about the bot"), + .setDescription("Get information about the bot") + .setContexts(InteractionContextType.Guild), async execute({ interaction, client }) { const castedDeps = dependencies as { [key: string]: string } diff --git a/src/commands/check.ts b/src/commands/check.ts index 32595d6..43d44d6 100644 --- a/src/commands/check.ts +++ b/src/commands/check.ts @@ -1,6 +1,6 @@ import { devMessage, embedColor } from "config/options.js" import { bwfkdr, bwstars, bwwins, duelswins, duelswlr, swkdr, swstars } from "config/reqs.js" -import { SlashCommandBuilder } from "discord.js" +import { InteractionContextType, SlashCommandBuilder } from "discord.js" import { ICommand } from "interfaces" import { bedwarsLevel, getGuild, getHeadURL, getPlayer, getUUID, hypixelLevel, skywarsLevel } from "utils/Hypixel.js" @@ -20,7 +20,8 @@ export default { .setMinLength(3) .setMaxLength(16) .setRequired(true) - ), + ) + .setContexts(InteractionContextType.Guild), async execute({ interaction }) { await interaction.deferReply({}) diff --git a/src/commands/clear.ts b/src/commands/clear.ts index 99a5add..5d62c7c 100644 --- a/src/commands/clear.ts +++ b/src/commands/clear.ts @@ -1,5 +1,5 @@ import { embedColor } from "config/options.js" -import { channelMention, PermissionFlagsBits, SlashCommandBuilder, TextChannel, userMention } from "discord.js" +import { channelMention, InteractionContextType, PermissionFlagsBits, SlashCommandBuilder, TextChannel, userMention } from "discord.js" import { ICommand } from "interfaces" import logToChannel from "utils/functions/logtochannel.js" @@ -18,7 +18,8 @@ export default { .setDescription("Amount of messages to clear") .setRequired(true) ) - .setDefaultMemberPermissions(PermissionFlagsBits.Administrator), + .setDefaultMemberPermissions(PermissionFlagsBits.Administrator) + .setContexts(InteractionContextType.Guild), async execute({ interaction }) { await interaction.deferReply({ ephemeral: true }) diff --git a/src/commands/config.ts b/src/commands/config.ts index 7b7b894..217112b 100644 --- a/src/commands/config.ts +++ b/src/commands/config.ts @@ -1,5 +1,5 @@ import { embedColor } from "config/options.js" -import { PermissionFlagsBits, SlashCommandBuilder } from "discord.js" +import { InteractionContextType, PermissionFlagsBits, SlashCommandBuilder } from "discord.js" import { ICommand } from "interfaces" import settings from "schemas/settingsTag.js" @@ -28,7 +28,8 @@ export default { .setDescription("The value to set") .setRequired(true) ) - .setDefaultMemberPermissions(PermissionFlagsBits.Administrator), + .setDefaultMemberPermissions(PermissionFlagsBits.Administrator) + .setContexts(InteractionContextType.Guild), async execute({ interaction }) { await interaction.deferReply() diff --git a/src/commands/counting.ts b/src/commands/counting.ts index d497a28..eb2704b 100644 --- a/src/commands/counting.ts +++ b/src/commands/counting.ts @@ -1,5 +1,5 @@ import { devMessage, embedColor } from "config/options.js" -import { PermissionFlagsBits, SlashCommandBuilder } from "discord.js" +import { InteractionContextType, PermissionFlagsBits, SlashCommandBuilder } from "discord.js" import { ICommand } from "interfaces" import ban from "./counting/ban.js" import unban from "./counting/unban.js" @@ -36,7 +36,8 @@ export default { .setRequired(true) ) ) - .setDefaultMemberPermissions(PermissionFlagsBits.Administrator), + .setDefaultMemberPermissions(PermissionFlagsBits.Administrator) + .setContexts(InteractionContextType.Guild), async execute({ interaction }) { const subcommand = interaction.options.getSubcommand() diff --git a/src/commands/find.ts b/src/commands/find.ts index 1bb128d..30f1cef 100644 --- a/src/commands/find.ts +++ b/src/commands/find.ts @@ -1,5 +1,5 @@ import { devMessage, embedColor } from "config/options.js" -import { PermissionFlagsBits, SlashCommandBuilder, userMention } from "discord.js" +import { InteractionContextType, PermissionFlagsBits, SlashCommandBuilder, userMention } from "discord.js" import { ICommand } from "interfaces" import verify from "schemas/verifyTag.js" import { getHeadURL, getIGN, getUUID } from "utils/Hypixel.js" @@ -19,7 +19,8 @@ export default { .setDescription("The ign to lookup.") .setRequired(true) ) - .setDefaultMemberPermissions(PermissionFlagsBits.Administrator), + .setDefaultMemberPermissions(PermissionFlagsBits.Administrator) + .setContexts(InteractionContextType.Guild), async execute({ interaction }) { await interaction.deferReply() diff --git a/src/commands/forceunverify.ts b/src/commands/forceunverify.ts index ef177a2..6d7a887 100644 --- a/src/commands/forceunverify.ts +++ b/src/commands/forceunverify.ts @@ -1,5 +1,5 @@ import { devMessage, embedColor } from "config/options.js" -import { GuildMember, PermissionFlagsBits, SlashCommandBuilder, userMention } from "discord.js" +import { GuildMember, InteractionContextType, PermissionFlagsBits, SlashCommandBuilder, userMention } from "discord.js" import { ICommand } from "interfaces" import verify from "schemas/verifyTag.js" import logToChannel from "utils/functions/logtochannel.js" @@ -21,7 +21,8 @@ export default { .setDescription("The user to force unverify") .setRequired(true) ) - .setDefaultMemberPermissions(PermissionFlagsBits.Administrator), + .setDefaultMemberPermissions(PermissionFlagsBits.Administrator) + .setContexts(InteractionContextType.Guild), async execute({ interaction }) { const member = interaction.options.getMember("user") as GuildMember diff --git a/src/commands/forceupdate.ts b/src/commands/forceupdate.ts index b961d16..0172750 100644 --- a/src/commands/forceupdate.ts +++ b/src/commands/forceupdate.ts @@ -1,6 +1,6 @@ import { devMessage, embedColor, hypixelGuildID } from "config/options.js" import { waitingListRole } from "config/roles.js" -import { GuildMember, PermissionFlagsBits, SlashCommandBuilder, userMention } from "discord.js" +import { GuildMember, InteractionContextType, PermissionFlagsBits, SlashCommandBuilder, userMention } from "discord.js" import { ICommand } from "interfaces" import verify from "schemas/verifyTag.js" import roleManage from "utils/functions/rolesmanage.js" @@ -21,7 +21,8 @@ export default { .setDescription("The user to force update") .setRequired(true) ) - .setDefaultMemberPermissions(PermissionFlagsBits.Administrator), + .setDefaultMemberPermissions(PermissionFlagsBits.Administrator) + .setContexts(InteractionContextType.Guild), async execute({ interaction }) { await interaction.deferReply() diff --git a/src/commands/forceverify.ts b/src/commands/forceverify.ts index 70d2b7d..e0b774d 100644 --- a/src/commands/forceverify.ts +++ b/src/commands/forceverify.ts @@ -1,5 +1,5 @@ import { devMessage, embedColor, hypixelGuildID } from "config/options.js" -import { GuildMember, PermissionFlagsBits, SlashCommandBuilder, userMention } from "discord.js" +import { GuildMember, InteractionContextType, PermissionFlagsBits, SlashCommandBuilder, userMention } from "discord.js" import { ICommand } from "interfaces" import verify from "schemas/verifyTag.js" import logToChannel from "utils/functions/logtochannel.js" @@ -25,7 +25,8 @@ export default { .setName("ign") .setDescription("The user's in-game name.") ) - .setDefaultMemberPermissions(PermissionFlagsBits.Administrator), + .setDefaultMemberPermissions(PermissionFlagsBits.Administrator) + .setContexts(InteractionContextType.Guild), async execute({ interaction }) { await interaction.deferReply() diff --git a/src/commands/guild.ts b/src/commands/guild.ts index 1cfa998..4db08de 100644 --- a/src/commands/guild.ts +++ b/src/commands/guild.ts @@ -1,5 +1,5 @@ import { devMessage, embedColor } from "config/options.js" -import { SlashCommandBuilder } from "discord.js" +import { InteractionContextType, SlashCommandBuilder } from "discord.js" import { ICommand } from "interfaces" import guildInfo from "./guild/info.js" import guildMember from "./guild/member.js" @@ -74,7 +74,8 @@ export default { .setName("amount") .setDescription("The amount of guild members to show. [Default: 10]") ) - ), + ) + .setContexts(InteractionContextType.Guild), async execute({ interaction }) { const subcommand = interaction.options.getSubcommand() diff --git a/src/commands/help.ts b/src/commands/help.ts index f769b8a..e5776bf 100644 --- a/src/commands/help.ts +++ b/src/commands/help.ts @@ -1,5 +1,5 @@ import { devMessage, embedColor } from "config/options.js" -import { SlashCommandBuilder } from "discord.js" +import { InteractionContextType, SlashCommandBuilder } from "discord.js" import { ICommand } from "interfaces" export default { @@ -10,7 +10,8 @@ export default { data: new SlashCommandBuilder() .setName("help") - .setDescription("List's all commands usable by a member"), + .setDescription("List's all commands usable by a member") + .setContexts(InteractionContextType.Guild), async execute({ interaction, client }) { await interaction.deferReply({ ephemeral: true }) diff --git a/src/commands/instructions.ts b/src/commands/instructions.ts index 4245127..27eda26 100644 --- a/src/commands/instructions.ts +++ b/src/commands/instructions.ts @@ -1,5 +1,5 @@ import { devMessage, embedColor, instructionsgif } from "config/options.js" -import { PermissionFlagsBits, SlashCommandBuilder } from "discord.js" +import { InteractionContextType, PermissionFlagsBits, SlashCommandBuilder } from "discord.js" import { ICommand } from "interfaces" export default { @@ -11,7 +11,8 @@ export default { data: new SlashCommandBuilder() .setName("instructions") .setDescription("Instructions for verification") - .setDefaultMemberPermissions(PermissionFlagsBits.Administrator), + .setDefaultMemberPermissions(PermissionFlagsBits.Administrator) + .setContexts(InteractionContextType.Guild), async execute({ interaction }) { await interaction.reply({ diff --git a/src/commands/kick.ts b/src/commands/kick.ts index c38c781..8259cb9 100644 --- a/src/commands/kick.ts +++ b/src/commands/kick.ts @@ -1,6 +1,6 @@ import { devMessage, embedColor } from "config/options.js" import { admin, helper } from "config/roles.js" -import { GuildMember, PermissionFlagsBits, SlashCommandBuilder, userMention } from "discord.js" +import { GuildMember, InteractionContextType, PermissionFlagsBits, SlashCommandBuilder, userMention } from "discord.js" import { ICommand } from "interfaces" import logToChannel from "utils/functions/logtochannel.js" @@ -24,7 +24,8 @@ export default { .setName("reason") .setDescription("Reason for kicking the member.") ) - .setDefaultMemberPermissions(PermissionFlagsBits.KickMembers), + .setDefaultMemberPermissions(PermissionFlagsBits.KickMembers) + .setContexts(InteractionContextType.Guild), async execute({ interaction }) { await interaction.deferReply() diff --git a/src/commands/music.ts b/src/commands/music.ts index 1a1e26f..78e7d7f 100644 --- a/src/commands/music.ts +++ b/src/commands/music.ts @@ -1,4 +1,4 @@ -import { PermissionFlagsBits, SlashCommandBuilder } from "discord.js" +import { InteractionContextType, PermissionFlagsBits, SlashCommandBuilder } from "discord.js" import { ICommand } from "interfaces" import leave from "./music/leave.js" import nowplaying from "./music/nowplaying.js" @@ -79,7 +79,8 @@ export default { .setName("leave") .setDescription("Leave the voice channel") ) - .setDefaultMemberPermissions(PermissionFlagsBits.Administrator), + .setDefaultMemberPermissions(PermissionFlagsBits.Administrator) + .setContexts(InteractionContextType.Guild), async execute({ interaction }) { const subcommand = interaction.options.getSubcommand() diff --git a/src/commands/ping.ts b/src/commands/ping.ts index b91cb72..88b737d 100644 --- a/src/commands/ping.ts +++ b/src/commands/ping.ts @@ -1,5 +1,5 @@ import { devMessage, embedColor } from "config/options.js" -import { SlashCommandBuilder } from "discord.js" +import { InteractionContextType, SlashCommandBuilder } from "discord.js" import { ICommand } from "interfaces" export default { @@ -10,7 +10,8 @@ export default { data: new SlashCommandBuilder() .setName("ping") - .setDescription("Get's the bot's ping."), + .setDescription("Get's the bot's ping.") + .setContexts(InteractionContextType.Guild), async execute({ interaction, client }) { await interaction.deferReply() diff --git a/src/commands/pp.ts b/src/commands/pp.ts index 0e548e6..0ee611c 100644 --- a/src/commands/pp.ts +++ b/src/commands/pp.ts @@ -1,5 +1,5 @@ import { embedColor } from "config/options.js" -import { SlashCommandBuilder, User } from "discord.js" +import { InteractionContextType, SlashCommandBuilder, User } from "discord.js" import { ICommand } from "interfaces" import env from "utils/Env.js" @@ -17,7 +17,8 @@ export default { .setName("user") .setDescription("User to show pp size") .setRequired(false) - ), + ) + .setContexts(InteractionContextType.Guild), async execute({ interaction }) { const user = (interaction.options.getUser("user") || interaction.user) as User diff --git a/src/commands/remove.ts b/src/commands/remove.ts index 8889e50..c2eb607 100644 --- a/src/commands/remove.ts +++ b/src/commands/remove.ts @@ -1,6 +1,6 @@ import { devMessage, embedColor } from "config/options.js" import { waitingListRole } from "config/roles.js" -import { GuildMember, PermissionFlagsBits, SlashCommandBuilder, userMention } from "discord.js" +import { GuildMember, InteractionContextType, PermissionFlagsBits, SlashCommandBuilder, userMention } from "discord.js" import { ICommand } from "interfaces" import waitinglist from "schemas/waitinglistTag.js" import logToChannel from "utils/functions/logtochannel.js" @@ -26,7 +26,8 @@ export default { .setDescription("The reason for removing the user.") .setRequired(false) ) - .setDefaultMemberPermissions(PermissionFlagsBits.Administrator), + .setDefaultMemberPermissions(PermissionFlagsBits.Administrator) + .setContexts(InteractionContextType.Guild), async execute({ interaction }) { await interaction.deferReply() diff --git a/src/commands/reqs.ts b/src/commands/reqs.ts index 29bb980..26a4631 100644 --- a/src/commands/reqs.ts +++ b/src/commands/reqs.ts @@ -1,6 +1,6 @@ import { devMessage, embedColor } from "config/options.js" import { bwfkdr, bwstars, bwwins, duelswins, duelswlr, swkdr, swstars } from "config/reqs.js" -import { SlashCommandBuilder } from "discord.js" +import { InteractionContextType, SlashCommandBuilder } from "discord.js" import { ICommand } from "interfaces" export default { @@ -11,7 +11,8 @@ export default { data: new SlashCommandBuilder() .setName("reqs") - .setDescription("Displays the requirements for the guild."), + .setDescription("Displays the requirements for the guild.") + .setContexts(InteractionContextType.Guild), async execute({ interaction }) { await interaction.reply({ diff --git a/src/commands/send.ts b/src/commands/send.ts index 139a06d..5bdde90 100644 --- a/src/commands/send.ts +++ b/src/commands/send.ts @@ -1,5 +1,5 @@ import { devMessage, embedColor } from "config/options.js" -import { ChannelType, PermissionFlagsBits, SlashCommandBuilder, TextChannel } from "discord.js" +import { ChannelType, InteractionContextType, PermissionFlagsBits, SlashCommandBuilder, TextChannel } from "discord.js" import { ICommand } from "interfaces" export default { @@ -23,7 +23,8 @@ export default { .setDescription("The channel to send the message to.") .addChannelTypes(ChannelType.GuildText, ChannelType.GuildAnnouncement) ) - .setDefaultMemberPermissions(PermissionFlagsBits.Administrator), + .setDefaultMemberPermissions(PermissionFlagsBits.Administrator) + .setContexts(InteractionContextType.Guild), async execute({ interaction }) { await interaction.deferReply({ ephemeral: true }) diff --git a/src/commands/setnick.ts b/src/commands/setnick.ts index 7406e03..1cdfb40 100644 --- a/src/commands/setnick.ts +++ b/src/commands/setnick.ts @@ -1,5 +1,5 @@ import { devMessage, embedColor } from "config/options.js" -import { GuildMember, PermissionFlagsBits, SlashCommandBuilder, userMention } from "discord.js" +import { GuildMember, InteractionContextType, PermissionFlagsBits, SlashCommandBuilder, userMention } from "discord.js" import { ICommand } from "interfaces" import logToChannel from "utils/functions/logtochannel.js" @@ -24,7 +24,8 @@ export default { .setDescription("The nickname to set") .setRequired(true) ) - .setDefaultMemberPermissions(PermissionFlagsBits.ManageNicknames), + .setDefaultMemberPermissions(PermissionFlagsBits.ManageNicknames) + .setContexts(InteractionContextType.Guild), async execute({ interaction }) { const member = interaction.options.getMember("user") as GuildMember diff --git a/src/commands/setup.ts b/src/commands/setup.ts index a0e8417..9f9cb5d 100644 --- a/src/commands/setup.ts +++ b/src/commands/setup.ts @@ -1,5 +1,14 @@ import { devMessage, embedColor } from "config/options.js" -import { ActionRowBuilder, ButtonBuilder, ButtonStyle, ChannelType, PermissionFlagsBits, SlashCommandBuilder, TextChannel } from "discord.js" +import { + ActionRowBuilder, + ButtonBuilder, + ButtonStyle, + ChannelType, + InteractionContextType, + PermissionFlagsBits, + SlashCommandBuilder, + TextChannel +} from "discord.js" import { ICommand } from "interfaces" export default { @@ -72,7 +81,8 @@ export default { .setRequired(true) ) ) - .setDefaultMemberPermissions(PermissionFlagsBits.Administrator), + .setDefaultMemberPermissions(PermissionFlagsBits.Administrator) + .setContexts(InteractionContextType.Guild), async execute({ interaction }) { const subcommand = interaction.options.getSubcommand() diff --git a/src/commands/slowmode.ts b/src/commands/slowmode.ts index 90064ef..dea4337 100644 --- a/src/commands/slowmode.ts +++ b/src/commands/slowmode.ts @@ -1,5 +1,5 @@ import { devMessage, embedColor } from "config/options.js" -import { channelMention, ChannelType, PermissionFlagsBits, SlashCommandBuilder, TextChannel, userMention } from "discord.js" +import { channelMention, ChannelType, InteractionContextType, PermissionFlagsBits, SlashCommandBuilder, TextChannel, userMention } from "discord.js" import { ICommand } from "interfaces" import logToChannel from "utils/functions/logtochannel.js" @@ -23,7 +23,8 @@ export default { .setDescription("The channel to set the slowmode of.") .addChannelTypes(ChannelType.GuildText, ChannelType.GuildAnnouncement) ) - .setDefaultMemberPermissions(PermissionFlagsBits.Administrator), + .setDefaultMemberPermissions(PermissionFlagsBits.Administrator) + .setContexts(InteractionContextType.Guild), async execute({ interaction }) { await interaction.deferReply({ ephemeral: true }) diff --git a/src/commands/staff.ts b/src/commands/staff.ts index 8ca1ce8..70224c1 100644 --- a/src/commands/staff.ts +++ b/src/commands/staff.ts @@ -1,5 +1,5 @@ import { devMessage, embedColor } from "config/options.js" -import { PermissionFlagsBits, SlashCommandBuilder } from "discord.js" +import { InteractionContextType, PermissionFlagsBits, SlashCommandBuilder } from "discord.js" import { ICommand } from "interfaces" import beast from "./staff/beast.js" import help from "./staff/help.js" @@ -48,7 +48,8 @@ export default { .setName("updateall") .setDescription("Update the discord roles of all guild members") ) - .setDefaultMemberPermissions(PermissionFlagsBits.Administrator), + .setDefaultMemberPermissions(PermissionFlagsBits.Administrator) + .setContexts(InteractionContextType.Guild), async execute({ interaction, client }) { const subcommand = interaction.options.getSubcommand() diff --git a/src/commands/timeout.ts b/src/commands/timeout.ts index 8a42e89..03e53c1 100644 --- a/src/commands/timeout.ts +++ b/src/commands/timeout.ts @@ -1,5 +1,5 @@ import { devMessage, embedColor } from "config/options.js" -import { GuildMember, PermissionFlagsBits, SlashCommandBuilder, userMention } from "discord.js" +import { GuildMember, InteractionContextType, PermissionFlagsBits, SlashCommandBuilder, userMention } from "discord.js" import { ICommand } from "interfaces" import ms from "ms" import prettyMs from "pretty-ms" @@ -31,7 +31,8 @@ export default { .setName("reason") .setDescription("The reason for the timeout") ) - .setDefaultMemberPermissions(PermissionFlagsBits.Administrator), + .setDefaultMemberPermissions(PermissionFlagsBits.Administrator) + .setContexts(InteractionContextType.Guild), async execute({ interaction }) { await interaction.deferReply() diff --git a/src/commands/unban.ts b/src/commands/unban.ts index 35858f4..0679bba 100644 --- a/src/commands/unban.ts +++ b/src/commands/unban.ts @@ -1,5 +1,5 @@ import { devMessage, embedColor } from "config/options.js" -import { PermissionFlagsBits, SlashCommandBuilder, User, userMention } from "discord.js" +import { InteractionContextType, PermissionFlagsBits, SlashCommandBuilder, User, userMention } from "discord.js" import { ICommand } from "interfaces" import logToChannel from "utils/functions/logtochannel.js" @@ -25,7 +25,8 @@ export default { .setDescription("The reason for unbanning the user") .setRequired(false) ) - .setDefaultMemberPermissions(PermissionFlagsBits.BanMembers), + .setDefaultMemberPermissions(PermissionFlagsBits.BanMembers) + .setContexts(InteractionContextType.Guild), async execute({ interaction }) { await interaction.deferReply() diff --git a/src/commands/update.ts b/src/commands/update.ts index 3c0c566..65d4880 100644 --- a/src/commands/update.ts +++ b/src/commands/update.ts @@ -1,6 +1,6 @@ import { devMessage, embedColor, hypixelGuildID } from "config/options.js" import { waitingListRole } from "config/roles.js" -import { GuildMember, SlashCommandBuilder } from "discord.js" +import { GuildMember, InteractionContextType, SlashCommandBuilder } from "discord.js" import { ICommand } from "interfaces" import verify from "schemas/verifyTag.js" import roleManage from "utils/functions/rolesmanage.js" @@ -14,7 +14,8 @@ export default { data: new SlashCommandBuilder() .setName("update") - .setDescription("Update your discord roles."), + .setDescription("Update your discord roles.") + .setContexts(InteractionContextType.Guild), async execute({ interaction }) { await interaction.deferReply() diff --git a/src/commands/uuid.ts b/src/commands/uuid.ts index 552aae1..ba7deeb 100644 --- a/src/commands/uuid.ts +++ b/src/commands/uuid.ts @@ -1,5 +1,5 @@ import { devMessage, embedColor } from "config/options.js" -import { SlashCommandBuilder } from "discord.js" +import { InteractionContextType, SlashCommandBuilder } from "discord.js" import { ICommand } from "interfaces" import { formatUuid, getHeadURL, getIGN, getUUID } from "utils/Hypixel.js" @@ -19,7 +19,8 @@ export default { .setMinLength(3) .setMaxLength(16) .setRequired(true) - ), + ) + .setContexts(InteractionContextType.Guild), async execute({ interaction }) { await interaction.deferReply() diff --git a/src/commands/verify.ts b/src/commands/verify.ts index 392b6c4..6d45f42 100644 --- a/src/commands/verify.ts +++ b/src/commands/verify.ts @@ -1,5 +1,5 @@ import { devMessage, embedColor, hypixelGuildID } from "config/options.js" -import { GuildMember, SlashCommandBuilder } from "discord.js" +import { GuildMember, InteractionContextType, SlashCommandBuilder } from "discord.js" import { ICommand } from "interfaces" import { IPlayerData } from "interfaces" import { IGuildData } from "interfaces" @@ -23,7 +23,8 @@ export default { .setMinLength(3) .setMaxLength(16) .setRequired(true) - ), + ) + .setContexts(InteractionContextType.Guild), async execute({ interaction }) { await interaction.deferReply() diff --git a/src/commands/whoami.ts b/src/commands/whoami.ts index 24ac72d..f496eb9 100644 --- a/src/commands/whoami.ts +++ b/src/commands/whoami.ts @@ -1,5 +1,5 @@ import { devMessage, embedColor } from "config/options.js" -import { SlashCommandBuilder, userMention } from "discord.js" +import { InteractionContextType, SlashCommandBuilder, userMention } from "discord.js" import { ICommand } from "interfaces" import verify from "schemas/verifyTag.js" import { getHeadURL, getIGN } from "utils/Hypixel.js" @@ -12,7 +12,8 @@ export default { data: new SlashCommandBuilder() .setName("whoami") - .setDescription("Get your user info"), + .setDescription("Get your user info") + .setContexts(InteractionContextType.Guild), async execute({ interaction }) { await interaction.deferReply() diff --git a/src/commands/whois.ts b/src/commands/whois.ts index 9af4efe..ae45f01 100644 --- a/src/commands/whois.ts +++ b/src/commands/whois.ts @@ -1,5 +1,5 @@ import { devMessage, embedColor } from "config/options.js" -import { PermissionFlagsBits, SlashCommandBuilder, userMention } from "discord.js" +import { InteractionContextType, PermissionFlagsBits, SlashCommandBuilder, userMention } from "discord.js" import { ICommand } from "interfaces" import verify from "schemas/verifyTag.js" import { getHeadURL, getIGN } from "utils/Hypixel.js" @@ -19,7 +19,8 @@ export default { .setDescription("The user to get the ign of.") .setRequired(true) ) - .setDefaultMemberPermissions(PermissionFlagsBits.Administrator), + .setDefaultMemberPermissions(PermissionFlagsBits.Administrator) + .setContexts(InteractionContextType.Guild), async execute({ interaction }) { await interaction.deferReply()