diff --git a/index.ts b/index.ts index 91d19a2..49b529f 100644 --- a/index.ts +++ b/index.ts @@ -2,12 +2,15 @@ import { ExtendedClient } from "./server/structures/client" import { config } from "./server/configuration" import { logger } from "./server/logger" import { JellyfinHandler } from "./server/jellyfin/handler" +import { attachedImages } from "./server/assets/attachments" const requestId = 'startup' export const jellyfinHandler = new JellyfinHandler(config) export const client = new ExtendedClient(jellyfinHandler) +export const attachmentImages = attachedImages + async function init() { try { const users = await jellyfinHandler.getCurrentUsers("", requestId) diff --git a/server/assets/attachments.ts b/server/assets/attachments.ts new file mode 100644 index 0000000..c7da60e --- /dev/null +++ b/server/assets/attachments.ts @@ -0,0 +1,12 @@ +import { AttachmentBuilder } from "discord.js" + +const splashScreen = new AttachmentBuilder('./server/assets/images/set_splashscreen.png') +const startScreen = new AttachmentBuilder('./server/assets/images/start_screen.png') +const serverConnection = new AttachmentBuilder('./server/assets/images/server_verbindung.png') +const accountChoice = new AttachmentBuilder('./server/assets/images/auswahl_anmeldung.png') +const loginScreen = new AttachmentBuilder('./server/assets/images/login_screen.png') +const overview = new AttachmentBuilder('./server/assets/images/jellyfin_ubersicht.png') +const joingroup = new AttachmentBuilder('./server/assets/images/gruppe_beitreten.png') +const resume = new AttachmentBuilder('./server/assets/images/wiedergabe_fortsetzen.png') +const leavegroup = new AttachmentBuilder('./server/assets/images/gruppe_verlassen.png') +export const attachedImages = [splashScreen, startScreen, serverConnection, accountChoice, loginScreen, overview, resume, leavegroup, joingroup] diff --git a/server/commands/mitgucken.ts b/server/commands/mitgucken.ts index 4d31bca..3ee3753 100644 --- a/server/commands/mitgucken.ts +++ b/server/commands/mitgucken.ts @@ -1,8 +1,9 @@ import { Command } from '../structures/command' import { RunOptions } from '../types/commandTypes' -import { AttachmentBuilder, APIEmbed } from 'discord.js' +import { APIEmbed } from 'discord.js' import { v4 as uuid } from 'uuid' import { logger } from '../logger' +import { attachmentImages } from '../..' const color = 0x0099FF export default new Command({ @@ -11,18 +12,7 @@ export default new Command({ options: [], run: async (interaction: RunOptions) => { const requestId = uuid() - const splashScreen = new AttachmentBuilder('./server/assets/images/set_splashscreen.png') - const startScreen = new AttachmentBuilder('./server/assets/images/start_screen.png') - const serverConnection = new AttachmentBuilder('./server/assets/images/server_verbindung.png') - const accountChoice = new AttachmentBuilder('./server/assets/images/auswahl_anmeldung.png') - const loginScreen = new AttachmentBuilder('./server/assets/images/login_screen.png') - const overview = new AttachmentBuilder('./server/assets/images/jellyfin_ubersicht.png') - const joingroup = new AttachmentBuilder('./server/assets/images/gruppe_beitreten.png') - const resume = new AttachmentBuilder('./server/assets/images/wiedergabe_fortsetzen.png') - const leavegroup = new AttachmentBuilder('./server/assets/images/gruppe_verlassen.png') - const attachedImages = [splashScreen, startScreen, serverConnection, accountChoice, loginScreen, overview, resume, leavegroup, joingroup] interaction.interaction.followUp('Ich schicke dir einen Guide per DM!') - logger.info(`Using images: ${JSON.stringify(attachedImages)}`) const embedList: APIEmbed[] = [] // DownloadLink embedList.push({ @@ -118,7 +108,8 @@ export default new Command({ description: "Wenn du aus der Watchparty rausgeflogen bist, oder die Wiedergabe verlassen hast, kannst du über das Menü oben rechts auch wieder zurückkehren.", }) //logger.info(`Trying to use ${splashScreen.name}`, { requestId, guildId: interaction.interaction.guild?.id }) + logger.info(`Sending guide to ${interaction.interaction.user.id}`, { requestId, guildId: interaction.interaction.guild?.id }) const userDMchannel = await interaction.interaction.user.createDM() - userDMchannel.send({ embeds: embedList, files: attachedImages }) + userDMchannel.send({ embeds: embedList, files: attachmentImages}) } })