Some checks failed
Build and Push Docker Image / build-and-push (push) Failing after 6m16s
21 lines
1.0 KiB
TypeScript
21 lines
1.0 KiB
TypeScript
import { MessageFlags } from "discord.js"
|
|
import type { ButtonInteraction } from "discord.js"
|
|
import type { GuildTwitch } from "@/types/schemas"
|
|
import dbGuild from "@/schemas/guild"
|
|
import { t } from "@/utils/i18n"
|
|
|
|
export const id = "twitch_streamer_add"
|
|
export async function execute(interaction: ButtonInteraction) {
|
|
const guildProfile = await dbGuild.findOne({ guildId: interaction.guild?.id })
|
|
if (!guildProfile) return interaction.reply({ content: t(interaction.locale, "common.database_not_found"), flags: MessageFlags.Ephemeral })
|
|
|
|
const dbData = guildProfile.get("guildTwitch") as GuildTwitch
|
|
if (!dbData.enabled) return interaction.reply({ content: t(interaction.locale, "twitch.module_disabled"), flags: MessageFlags.Ephemeral })
|
|
if (!dbData.channelId) return interaction.reply({ content: t(interaction.locale, "twitch.configure_channel_first"), flags: MessageFlags.Ephemeral })
|
|
|
|
return interaction.reply({
|
|
content: t(interaction.locale, "twitch.add_streamer_command"),
|
|
flags: MessageFlags.Ephemeral
|
|
})
|
|
}
|