From 7670299491bb722ce898aacce0e7335dbaaac17e Mon Sep 17 00:00:00 2001 From: Taken Date: Mon, 9 Sep 2024 09:18:19 +0200 Subject: [PATCH 1/5] Updated some types --- src/commands/staff/prune.ts | 2 +- src/commands/staff/updateall.ts | 4 ++-- src/events/server/messages/eval.ts | 9 ++++++--- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/commands/staff/prune.ts b/src/commands/staff/prune.ts index c3de388..d890013 100644 --- a/src/commands/staff/prune.ts +++ b/src/commands/staff/prune.ts @@ -67,7 +67,7 @@ export default async function prune(interaction: ChatInputCommandInteraction): P ) ] }).then(async (m) => { - const collector = interaction.channel!.createMessageComponentCollector({ + const collector = m.createMessageComponentCollector({ componentType: ComponentType.Button, filter: (i: ButtonInteraction) => (i.customId === buttonid || i.customId === cancelid) && diff --git a/src/commands/staff/updateall.ts b/src/commands/staff/updateall.ts index c1e4cd4..0e29eec 100644 --- a/src/commands/staff/updateall.ts +++ b/src/commands/staff/updateall.ts @@ -1,5 +1,5 @@ import { embedColor, hypixelGuildID } from "config/options.js" -import { ChatInputCommandInteraction, GuildMember } from "discord.js" +import { ChatInputCommandInteraction, GuildMember, TextChannel } from "discord.js" import { IGuildData } from "interfaces" import verify from "schemas/verifyTag.js" import env from "utils/Env.js" @@ -117,7 +117,7 @@ export default async function updateAll(interaction: ChatInputCommandInteraction console.log("Successfully updated all roles.") - await interaction.channel?.send({ + await (interaction.channel as TextChannel)?.send({ embeds: [{ description: "Successfully updated all roles.", color: embedColor diff --git a/src/events/server/messages/eval.ts b/src/events/server/messages/eval.ts index a1f9587..455b342 100644 --- a/src/events/server/messages/eval.ts +++ b/src/events/server/messages/eval.ts @@ -1,4 +1,4 @@ -import { Message } from "discord.js" +import { ChannelType, Message } from "discord.js" import { IEvent } from "interfaces" import env from "utils/Env.js" @@ -14,17 +14,20 @@ export default { if (!message.content.startsWith("!eval")) return const code = message.content.split(" ").slice(1).join(" ") + const channel = message.channel + + if (channel.type !== ChannelType.GuildText) return try { const output = eval(code) const outputString = String(output) - await message.channel.send({ + await channel.send({ embeds: [{ description: `\`\`\`js\n${outputString}\`\`\`` }] }) } catch (error) { - await message.channel.send({ + await channel.send({ embeds: [{ description: `\`\`\`js\n${error}\`\`\`` }] From 6f8ee0f8bb68241d85fb71dd9d774b1e52740dee Mon Sep 17 00:00:00 2001 From: Taken Date: Mon, 9 Sep 2024 21:58:06 +0200 Subject: [PATCH 2/5] Removed deprecated method --- src/commands-contextmenu/updateuser.ts | 3 +-- src/commands/anime.ts | 3 +-- src/commands/ban.ts | 3 +-- src/commands/botinfo.ts | 3 +-- src/commands/check.ts | 3 +-- src/commands/clear.ts | 3 +-- src/commands/config.ts | 1 - src/commands/counting.ts | 3 +-- src/commands/find.ts | 3 +-- src/commands/forceunverify.ts | 1 - src/commands/forceupdate.ts | 3 +-- src/commands/forceverify.ts | 3 +-- src/commands/guild.ts | 3 +-- src/commands/help.ts | 3 +-- src/commands/instructions.ts | 3 +-- src/commands/kick.ts | 3 +-- src/commands/music.ts | 1 - src/commands/ping.ts | 3 +-- src/commands/pp.ts | 3 +-- src/commands/remove.ts | 3 +-- src/commands/reqs.ts | 3 +-- src/commands/send.ts | 3 +-- src/commands/setnick.ts | 3 +-- src/commands/setup.ts | 3 +-- src/commands/slowmode.ts | 3 +-- src/commands/staff.ts | 3 +-- src/commands/timeout.ts | 3 +-- src/commands/unban.ts | 3 +-- src/commands/update.ts | 3 +-- src/commands/uuid.ts | 3 +-- src/commands/verify.ts | 3 +-- src/commands/whoami.ts | 3 +-- src/commands/whois.ts | 3 +-- 33 files changed, 30 insertions(+), 63 deletions(-) diff --git a/src/commands-contextmenu/updateuser.ts b/src/commands-contextmenu/updateuser.ts index 205853e..bb3c13c 100644 --- a/src/commands-contextmenu/updateuser.ts +++ b/src/commands-contextmenu/updateuser.ts @@ -14,8 +14,7 @@ export default { data: new ContextMenuCommandBuilder() .setName("Update User") .setType(ApplicationCommandType.User) - .setDefaultMemberPermissions(PermissionFlagsBits.Administrator) - .setDMPermission(false), + .setDefaultMemberPermissions(PermissionFlagsBits.Administrator), async execute({ interaction }) { await interaction.deferReply({ ephemeral: true }) diff --git a/src/commands/anime.ts b/src/commands/anime.ts index 4cf9c73..c7ac1c4 100644 --- a/src/commands/anime.ts +++ b/src/commands/anime.ts @@ -17,8 +17,7 @@ export default { .setName("query") .setDescription("The anime to search for") .setRequired(true) - ) - .setDMPermission(false), + ), async execute({ interaction }) { await interaction.deferReply() diff --git a/src/commands/ban.ts b/src/commands/ban.ts index 303bc91..6b14b51 100644 --- a/src/commands/ban.ts +++ b/src/commands/ban.ts @@ -38,8 +38,7 @@ export default { { name: "7 days", value: 7 } ) ) - .setDefaultMemberPermissions(PermissionFlagsBits.BanMembers) - .setDMPermission(false), + .setDefaultMemberPermissions(PermissionFlagsBits.BanMembers), async execute({ interaction }) { await interaction.deferReply() diff --git a/src/commands/botinfo.ts b/src/commands/botinfo.ts index 5f57c9e..4a6acda 100644 --- a/src/commands/botinfo.ts +++ b/src/commands/botinfo.ts @@ -17,8 +17,7 @@ export default { data: new SlashCommandBuilder() .setName("botinfo") - .setDescription("Get information about the bot") - .setDMPermission(false), + .setDescription("Get information about the bot"), async execute({ interaction, client }) { const castedDeps = dependencies as { [key: string]: string } diff --git a/src/commands/check.ts b/src/commands/check.ts index 7c8d607..32595d6 100644 --- a/src/commands/check.ts +++ b/src/commands/check.ts @@ -20,8 +20,7 @@ export default { .setMinLength(3) .setMaxLength(16) .setRequired(true) - ) - .setDMPermission(false), + ), async execute({ interaction }) { await interaction.deferReply({}) diff --git a/src/commands/clear.ts b/src/commands/clear.ts index 768cee0..99a5add 100644 --- a/src/commands/clear.ts +++ b/src/commands/clear.ts @@ -18,8 +18,7 @@ export default { .setDescription("Amount of messages to clear") .setRequired(true) ) - .setDefaultMemberPermissions(PermissionFlagsBits.Administrator) - .setDMPermission(false), + .setDefaultMemberPermissions(PermissionFlagsBits.Administrator), async execute({ interaction }) { await interaction.deferReply({ ephemeral: true }) diff --git a/src/commands/config.ts b/src/commands/config.ts index ccf57b7..7b7b894 100644 --- a/src/commands/config.ts +++ b/src/commands/config.ts @@ -28,7 +28,6 @@ export default { .setDescription("The value to set") .setRequired(true) ) - .setDMPermission(false) .setDefaultMemberPermissions(PermissionFlagsBits.Administrator), async execute({ interaction }) { diff --git a/src/commands/counting.ts b/src/commands/counting.ts index c6b8333..d497a28 100644 --- a/src/commands/counting.ts +++ b/src/commands/counting.ts @@ -36,8 +36,7 @@ export default { .setRequired(true) ) ) - .setDefaultMemberPermissions(PermissionFlagsBits.Administrator) - .setDMPermission(false), + .setDefaultMemberPermissions(PermissionFlagsBits.Administrator), async execute({ interaction }) { const subcommand = interaction.options.getSubcommand() diff --git a/src/commands/find.ts b/src/commands/find.ts index ef5320f..1bb128d 100644 --- a/src/commands/find.ts +++ b/src/commands/find.ts @@ -19,8 +19,7 @@ export default { .setDescription("The ign to lookup.") .setRequired(true) ) - .setDefaultMemberPermissions(PermissionFlagsBits.Administrator) - .setDMPermission(false), + .setDefaultMemberPermissions(PermissionFlagsBits.Administrator), async execute({ interaction }) { await interaction.deferReply() diff --git a/src/commands/forceunverify.ts b/src/commands/forceunverify.ts index 6a3605c..ef177a2 100644 --- a/src/commands/forceunverify.ts +++ b/src/commands/forceunverify.ts @@ -21,7 +21,6 @@ export default { .setDescription("The user to force unverify") .setRequired(true) ) - .setDMPermission(false) .setDefaultMemberPermissions(PermissionFlagsBits.Administrator), async execute({ interaction }) { diff --git a/src/commands/forceupdate.ts b/src/commands/forceupdate.ts index e871aec..b961d16 100644 --- a/src/commands/forceupdate.ts +++ b/src/commands/forceupdate.ts @@ -21,8 +21,7 @@ export default { .setDescription("The user to force update") .setRequired(true) ) - .setDefaultMemberPermissions(PermissionFlagsBits.Administrator) - .setDMPermission(false), + .setDefaultMemberPermissions(PermissionFlagsBits.Administrator), async execute({ interaction }) { await interaction.deferReply() diff --git a/src/commands/forceverify.ts b/src/commands/forceverify.ts index 6ecc1ae..70d2b7d 100644 --- a/src/commands/forceverify.ts +++ b/src/commands/forceverify.ts @@ -25,8 +25,7 @@ export default { .setName("ign") .setDescription("The user's in-game name.") ) - .setDefaultMemberPermissions(PermissionFlagsBits.Administrator) - .setDMPermission(false), + .setDefaultMemberPermissions(PermissionFlagsBits.Administrator), async execute({ interaction }) { await interaction.deferReply() diff --git a/src/commands/guild.ts b/src/commands/guild.ts index a102d09..1cfa998 100644 --- a/src/commands/guild.ts +++ b/src/commands/guild.ts @@ -74,8 +74,7 @@ export default { .setName("amount") .setDescription("The amount of guild members to show. [Default: 10]") ) - ) - .setDMPermission(false), + ), async execute({ interaction }) { const subcommand = interaction.options.getSubcommand() diff --git a/src/commands/help.ts b/src/commands/help.ts index 3629b80..f769b8a 100644 --- a/src/commands/help.ts +++ b/src/commands/help.ts @@ -10,8 +10,7 @@ export default { data: new SlashCommandBuilder() .setName("help") - .setDescription("List's all commands usable by a member") - .setDMPermission(false), + .setDescription("List's all commands usable by a member"), async execute({ interaction, client }) { await interaction.deferReply({ ephemeral: true }) diff --git a/src/commands/instructions.ts b/src/commands/instructions.ts index c0e8612..4245127 100644 --- a/src/commands/instructions.ts +++ b/src/commands/instructions.ts @@ -11,8 +11,7 @@ export default { data: new SlashCommandBuilder() .setName("instructions") .setDescription("Instructions for verification") - .setDefaultMemberPermissions(PermissionFlagsBits.Administrator) - .setDMPermission(false), + .setDefaultMemberPermissions(PermissionFlagsBits.Administrator), async execute({ interaction }) { await interaction.reply({ diff --git a/src/commands/kick.ts b/src/commands/kick.ts index 03aa3ea..c38c781 100644 --- a/src/commands/kick.ts +++ b/src/commands/kick.ts @@ -24,8 +24,7 @@ export default { .setName("reason") .setDescription("Reason for kicking the member.") ) - .setDefaultMemberPermissions(PermissionFlagsBits.KickMembers) - .setDMPermission(false), + .setDefaultMemberPermissions(PermissionFlagsBits.KickMembers), async execute({ interaction }) { await interaction.deferReply() diff --git a/src/commands/music.ts b/src/commands/music.ts index 7efd37f..1a1e26f 100644 --- a/src/commands/music.ts +++ b/src/commands/music.ts @@ -79,7 +79,6 @@ export default { .setName("leave") .setDescription("Leave the voice channel") ) - .setDMPermission(false) .setDefaultMemberPermissions(PermissionFlagsBits.Administrator), async execute({ interaction }) { diff --git a/src/commands/ping.ts b/src/commands/ping.ts index 3115774..b91cb72 100644 --- a/src/commands/ping.ts +++ b/src/commands/ping.ts @@ -10,8 +10,7 @@ export default { data: new SlashCommandBuilder() .setName("ping") - .setDescription("Get's the bot's ping.") - .setDMPermission(false), + .setDescription("Get's the bot's ping."), async execute({ interaction, client }) { await interaction.deferReply() diff --git a/src/commands/pp.ts b/src/commands/pp.ts index 043653b..0e548e6 100644 --- a/src/commands/pp.ts +++ b/src/commands/pp.ts @@ -17,8 +17,7 @@ export default { .setName("user") .setDescription("User to show pp size") .setRequired(false) - ) - .setDMPermission(false), + ), 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 09c1afd..8889e50 100644 --- a/src/commands/remove.ts +++ b/src/commands/remove.ts @@ -26,8 +26,7 @@ export default { .setDescription("The reason for removing the user.") .setRequired(false) ) - .setDefaultMemberPermissions(PermissionFlagsBits.Administrator) - .setDMPermission(false), + .setDefaultMemberPermissions(PermissionFlagsBits.Administrator), async execute({ interaction }) { await interaction.deferReply() diff --git a/src/commands/reqs.ts b/src/commands/reqs.ts index 46260ff..29bb980 100644 --- a/src/commands/reqs.ts +++ b/src/commands/reqs.ts @@ -11,8 +11,7 @@ export default { data: new SlashCommandBuilder() .setName("reqs") - .setDescription("Displays the requirements for the guild.") - .setDMPermission(false), + .setDescription("Displays the requirements for the guild."), async execute({ interaction }) { await interaction.reply({ diff --git a/src/commands/send.ts b/src/commands/send.ts index fc1ecb6..139a06d 100644 --- a/src/commands/send.ts +++ b/src/commands/send.ts @@ -23,8 +23,7 @@ export default { .setDescription("The channel to send the message to.") .addChannelTypes(ChannelType.GuildText, ChannelType.GuildAnnouncement) ) - .setDefaultMemberPermissions(PermissionFlagsBits.Administrator) - .setDMPermission(false), + .setDefaultMemberPermissions(PermissionFlagsBits.Administrator), async execute({ interaction }) { await interaction.deferReply({ ephemeral: true }) diff --git a/src/commands/setnick.ts b/src/commands/setnick.ts index 7dfe691..7406e03 100644 --- a/src/commands/setnick.ts +++ b/src/commands/setnick.ts @@ -24,8 +24,7 @@ export default { .setDescription("The nickname to set") .setRequired(true) ) - .setDefaultMemberPermissions(PermissionFlagsBits.ManageNicknames) - .setDMPermission(false), + .setDefaultMemberPermissions(PermissionFlagsBits.ManageNicknames), async execute({ interaction }) { const member = interaction.options.getMember("user") as GuildMember diff --git a/src/commands/setup.ts b/src/commands/setup.ts index 8b25044..a0e8417 100644 --- a/src/commands/setup.ts +++ b/src/commands/setup.ts @@ -72,8 +72,7 @@ export default { .setRequired(true) ) ) - .setDefaultMemberPermissions(PermissionFlagsBits.Administrator) - .setDMPermission(false), + .setDefaultMemberPermissions(PermissionFlagsBits.Administrator), async execute({ interaction }) { const subcommand = interaction.options.getSubcommand() diff --git a/src/commands/slowmode.ts b/src/commands/slowmode.ts index 9952c5a..90064ef 100644 --- a/src/commands/slowmode.ts +++ b/src/commands/slowmode.ts @@ -23,8 +23,7 @@ export default { .setDescription("The channel to set the slowmode of.") .addChannelTypes(ChannelType.GuildText, ChannelType.GuildAnnouncement) ) - .setDefaultMemberPermissions(PermissionFlagsBits.Administrator) - .setDMPermission(false), + .setDefaultMemberPermissions(PermissionFlagsBits.Administrator), async execute({ interaction }) { await interaction.deferReply({ ephemeral: true }) diff --git a/src/commands/staff.ts b/src/commands/staff.ts index 83906a1..8ca1ce8 100644 --- a/src/commands/staff.ts +++ b/src/commands/staff.ts @@ -48,8 +48,7 @@ export default { .setName("updateall") .setDescription("Update the discord roles of all guild members") ) - .setDefaultMemberPermissions(PermissionFlagsBits.Administrator) - .setDMPermission(false), + .setDefaultMemberPermissions(PermissionFlagsBits.Administrator), async execute({ interaction, client }) { const subcommand = interaction.options.getSubcommand() diff --git a/src/commands/timeout.ts b/src/commands/timeout.ts index 812d1f7..8a42e89 100644 --- a/src/commands/timeout.ts +++ b/src/commands/timeout.ts @@ -31,8 +31,7 @@ export default { .setName("reason") .setDescription("The reason for the timeout") ) - .setDefaultMemberPermissions(PermissionFlagsBits.Administrator) - .setDMPermission(false), + .setDefaultMemberPermissions(PermissionFlagsBits.Administrator), async execute({ interaction }) { await interaction.deferReply() diff --git a/src/commands/unban.ts b/src/commands/unban.ts index 1d64b23..35858f4 100644 --- a/src/commands/unban.ts +++ b/src/commands/unban.ts @@ -25,8 +25,7 @@ export default { .setDescription("The reason for unbanning the user") .setRequired(false) ) - .setDefaultMemberPermissions(PermissionFlagsBits.BanMembers) - .setDMPermission(false), + .setDefaultMemberPermissions(PermissionFlagsBits.BanMembers), async execute({ interaction }) { await interaction.deferReply() diff --git a/src/commands/update.ts b/src/commands/update.ts index 748e87f..3c0c566 100644 --- a/src/commands/update.ts +++ b/src/commands/update.ts @@ -14,8 +14,7 @@ export default { data: new SlashCommandBuilder() .setName("update") - .setDescription("Update your discord roles.") - .setDMPermission(false), + .setDescription("Update your discord roles."), async execute({ interaction }) { await interaction.deferReply() diff --git a/src/commands/uuid.ts b/src/commands/uuid.ts index 2368ace..552aae1 100644 --- a/src/commands/uuid.ts +++ b/src/commands/uuid.ts @@ -19,8 +19,7 @@ export default { .setMinLength(3) .setMaxLength(16) .setRequired(true) - ) - .setDMPermission(false), + ), async execute({ interaction }) { await interaction.deferReply() diff --git a/src/commands/verify.ts b/src/commands/verify.ts index 2dc7319..392b6c4 100644 --- a/src/commands/verify.ts +++ b/src/commands/verify.ts @@ -23,8 +23,7 @@ export default { .setMinLength(3) .setMaxLength(16) .setRequired(true) - ) - .setDMPermission(false), + ), async execute({ interaction }) { await interaction.deferReply() diff --git a/src/commands/whoami.ts b/src/commands/whoami.ts index 4a50acb..24ac72d 100644 --- a/src/commands/whoami.ts +++ b/src/commands/whoami.ts @@ -12,8 +12,7 @@ export default { data: new SlashCommandBuilder() .setName("whoami") - .setDescription("Get your user info") - .setDMPermission(false), + .setDescription("Get your user info"), async execute({ interaction }) { await interaction.deferReply() diff --git a/src/commands/whois.ts b/src/commands/whois.ts index 82c5b47..9af4efe 100644 --- a/src/commands/whois.ts +++ b/src/commands/whois.ts @@ -19,8 +19,7 @@ export default { .setDescription("The user to get the ign of.") .setRequired(true) ) - .setDefaultMemberPermissions(PermissionFlagsBits.Administrator) - .setDMPermission(false), + .setDefaultMemberPermissions(PermissionFlagsBits.Administrator), async execute({ interaction }) { await interaction.deferReply() From d8dd8f4e70f42beb6b41a359adcebe077e7a6ccd Mon Sep 17 00:00:00 2001 From: Taken Date: Mon, 9 Sep 2024 22:11:51 +0200 Subject: [PATCH 3/5] 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() From 0c2ce02502568d04c46070e805248f550d460d4e Mon Sep 17 00:00:00 2001 From: Taken Date: Mon, 9 Sep 2024 22:12:18 +0200 Subject: [PATCH 4/5] Updated scripts --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 678d760..fa88922 100644 --- a/package.json +++ b/package.json @@ -19,8 +19,9 @@ "dev:ts": "nodemon --config nodemon.json src/index.ts", "dev:js": "nodemon --config nodemon-js.json dist/index.js", "format": "dprint fmt \"**/*.ts\"", - "check": "tsc --noEmit", - "lint": "eslint", + "check": "yarn tscheck && yarn lint", + "tscheck": "tsc && echo \"TypeScript check passed!\"", + "lint": "eslint && echo \"Linting passed!\"", "lint:fix": "eslint --fix", "push:prod": "tsx scripts/deploy-commands.ts", "push:dev": "tsx scripts/dev-deploy.ts", From fc50bc7a78b0a3cce61a26276845b36cb295f43c Mon Sep 17 00:00:00 2001 From: Taken Date: Mon, 9 Sep 2024 22:20:39 +0200 Subject: [PATCH 5/5] Small tweak --- src/commands/staff/updateall.ts | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/commands/staff/updateall.ts b/src/commands/staff/updateall.ts index 0e29eec..82d90cc 100644 --- a/src/commands/staff/updateall.ts +++ b/src/commands/staff/updateall.ts @@ -1,5 +1,5 @@ import { embedColor, hypixelGuildID } from "config/options.js" -import { ChatInputCommandInteraction, GuildMember, TextChannel } from "discord.js" +import { ChannelType, ChatInputCommandInteraction, GuildMember, TextChannel } from "discord.js" import { IGuildData } from "interfaces" import verify from "schemas/verifyTag.js" import env from "utils/Env.js" @@ -11,6 +11,17 @@ export default async function updateAll(interaction: ChatInputCommandInteraction await interaction.deferReply() const discordMember = interaction.member as GuildMember + const channel = interaction.channel + + if (channel?.type !== ChannelType.GuildText) { + await interaction.editReply({ + embeds: [{ + description: "This command can only be used in a server.", + color: embedColor + }] + }) + return + } if (discordMember.user.id !== env.prod.dev) { await interaction.editReply({ @@ -117,7 +128,7 @@ export default async function updateAll(interaction: ChatInputCommandInteraction console.log("Successfully updated all roles.") - await (interaction.channel as TextChannel)?.send({ + await channel.send({ embeds: [{ description: "Successfully updated all roles.", color: embedColor