some API typings
diff --git a/src/commands/mod/viewas.ts b/src/commands/mod/viewas.ts
index 6216a37..9c163a7 100644
--- a/src/commands/mod/viewas.ts
+++ b/src/commands/mod/viewas.ts
@@ -22,13 +22,7 @@
.addUserOption((option) => option.setName("member").setDescription("The member to view as").setRequired(true));
const callback = async (interaction: CommandInteraction): Promise<void> => {
- /*
- * {
- categoryObject: channel[],
- categoryObject: channel[],
- "null": channel[]
- }
- */
+
const m = await interaction.reply({embeds: LoadingEmbed, ephemeral: true, fetchReply: true})
let channels: Record<string, GuildBasedChannel[]> = {"": []};
@@ -105,7 +99,7 @@
threads = channel.threads.cache.toJSON().map((t) => t as Discord.ThreadChannel);
}
const nsfw = ("nsfw" in channel ? channel.nsfw : false) && NSFWAvailable.includes(channelType)
- const emojiName = channelTypeEmoji[channelType] + (nsfw ? "_NSFW" : "");
+ const emojiName = channelTypeEmoji[channelType.valueOf()] + (nsfw ? "_NSFW" : "");
const emoji = getEmojiByName("ICONS.CHANNEL." + (threads.length ? "THREAD_CHANNEL" : emojiName));
let current = `${emoji} ${channel.name}`;
if (threads.length) {
diff --git a/src/commands/settings/welcome.ts b/src/commands/settings/welcome.ts
index 9892638..e7143fb 100644
--- a/src/commands/settings/welcome.ts
+++ b/src/commands/settings/welcome.ts
@@ -8,7 +8,9 @@
MessageComponentInteraction,
Role,
ButtonStyle,
- AutocompleteInteraction
+ AutocompleteInteraction,
+ GuildChannel,
+ EmbedBuilder
} from "discord.js";
import type { SlashCommandSubcommandBuilder } from "@discordjs/builders";
import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
@@ -50,17 +52,17 @@
});
let m: Message;
if (
- interaction.options.getRole("role") ||
- interaction.options.getChannel("channel") ||
- interaction.options.getString("message")
+ interaction.options.get("role")?.role ||
+ interaction.options.get("channel")?.channel ||
+ interaction.options.get("message")?.value as string
) {
let role: Role | null;
let ping: Role | null;
let channel: Channel | null;
- const message: string | null = interaction.options.getString("message");
+ const message: string | null = interaction.options.get("message")?.value as string | null;
try {
- role = interaction.options.getRole("role") as Role | null;
- ping = interaction.options.getRole("ping") as Role | null;
+ role = interaction.options.get("role")?.role as Role | null;
+ ping = interaction.options.get("ping")?.role as Role | null;
} catch {
return await interaction.editReply({
embeds: [
@@ -73,7 +75,7 @@
});
}
try {
- channel = interaction.options.getChannel("channel") as Channel | null;
+ channel = interaction.options.get("channel")?.channel as Channel | null;
} catch {
return await interaction.editReply({
embeds: [
@@ -94,13 +96,14 @@
if (role) options.role = renderRole(role);
if (ping) options.ping = renderRole(ping);
- if (channel) options.channel = renderChannel(channel);
+ if (channel) options.channel = renderChannel(channel as GuildChannel);
if (message) options.message = "\n> " + message;
const confirmation = await new confirmationMessage(interaction)
- .setEmoji("GUILD.ROLES.EDIT", "GUILD.ROLES.DELETE")
+ .setEmoji("GUILD.ROLES.EDIT")
.setTitle("Welcome Events")
.setDescription(generateKeyValueList(options))
.setColor("Warning")
+ .setFailedMessage("Cancelled", "Warning", "GUILD.ROLES.DELETE") //TODO: Actual Message Needed
.setInverted(true)
.send(true);
if (confirmation.cancelled) return;
@@ -130,7 +133,7 @@
};
if (role) list.role = entry(role.id, renderRole(role));
if (ping) list.ping = entry(ping.id, renderRole(ping));
- if (channel) list.channel = entry(channel.id, renderChannel(channel.id));
+ if (channel) list.channel = entry(channel.id, renderChannel(channel as GuildChannel));
if (message) list.message = entry(message, `\`${message}\``);
const data = {
meta: {
@@ -185,19 +188,19 @@
`**Message:** ${config.welcome.message ? `\n> ${config.welcome.message}` : "*None set*"}\n` +
`**Role:** ${
config.welcome.role
- ? renderRole(await interaction.guild!.roles.fetch(config.welcome.role))
+ ? renderRole((await interaction.guild!.roles.fetch(config.welcome.role))!)
: "*None set*"
}\n` +
`**Ping:** ${
config.welcome.ping
- ? renderRole(await interaction.guild!.roles.fetch(config.welcome.ping))
+ ? renderRole((await interaction.guild!.roles.fetch(config.welcome.ping))!)
: "*None set*"
}\n` +
`**Channel:** ${
config.welcome.channel
? config.welcome.channel == "dm"
? "DM"
- : renderChannel(await interaction.guild!.channels.fetch(config.welcome.channel))
+ : renderChannel((await interaction.guild!.channels.fetch(config.welcome.channel))!)
: "*None set*"
}`
)
@@ -293,7 +296,7 @@
}
} while (!timedOut);
await interaction.editReply({
- embeds: [m.embeds[0]!.setFooter({ text: "Message timed out" })],
+ embeds: [new EmbedBuilder(m.embeds[0]!.data).setFooter({ text: "Message timed out" })],
components: []
});
};