mirror of
https://github.com/JonnyBro/JaBa.git
synced 2025-03-31 19:22:00 +05:00
refactor: guild always exists in config command, but TS doesn't know that 🤷
This commit is contained in:
parent
c8851d6e4d
commit
78dcc67c02
1 changed files with 4 additions and 6 deletions
|
@ -1,4 +1,4 @@
|
||||||
import { getLocalizedDesc, replyError, translateContext } from "@/helpers/extenders.js";
|
import { getLocalizedDesc, translateContext } from "@/helpers/extenders.js";
|
||||||
import GuildModel from "@/models/GuildModel.js";
|
import GuildModel from "@/models/GuildModel.js";
|
||||||
import { CommandData, SlashCommandProps } from "@/types.js";
|
import { CommandData, SlashCommandProps } from "@/types.js";
|
||||||
import { generateFields } from "@/utils/config-fields.js";
|
import { generateFields } from "@/utils/config-fields.js";
|
||||||
|
@ -64,17 +64,15 @@ export const data: CommandData = {
|
||||||
export const run = async ({ interaction }: SlashCommandProps) => {
|
export const run = async ({ interaction }: SlashCommandProps) => {
|
||||||
await interaction.deferReply({ flags: MessageFlags.Ephemeral });
|
await interaction.deferReply({ flags: MessageFlags.Ephemeral });
|
||||||
|
|
||||||
if (!interaction.guild) return replyError(interaction, "misc:GUILD_ONLY", null, { edit: true });
|
const guildData = await client.getGuildData(interaction.guild!.id);
|
||||||
|
|
||||||
const guildData = await client.getGuildData(interaction.guild.id);
|
|
||||||
const command = interaction.options.getSubcommand();
|
const command = interaction.options.getSubcommand();
|
||||||
|
|
||||||
if (command === "list") {
|
if (command === "list") {
|
||||||
const fields = await generateFields(interaction, guildData);
|
const fields = await generateFields(interaction, guildData);
|
||||||
const embed = createEmbed({
|
const embed = createEmbed({
|
||||||
author: {
|
author: {
|
||||||
name: interaction.guild.name,
|
name: interaction.guild!.name,
|
||||||
iconURL: interaction.guild.iconURL() || "",
|
iconURL: interaction.guild!.iconURL() || "",
|
||||||
},
|
},
|
||||||
fields,
|
fields,
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Reference in a new issue