complete guides

This commit is contained in:
Sammy 2023-06-09 21:30:24 +02:00
parent 24c120a890
commit 3e152864fd
3 changed files with 187 additions and 115 deletions

View File

@ -1,12 +1,12 @@
import { AttachmentBuilder } from "discord.js" import { AttachmentBuilder } from "discord.js"
const splashScreen = new AttachmentBuilder('./server/assets/images/set_splashscreen.png') export const splashScreen = new AttachmentBuilder('./server/assets/images/set_splashscreen.png')
const startScreen = new AttachmentBuilder('./server/assets/images/start_screen.png') export const startScreen = new AttachmentBuilder('./server/assets/images/start_screen.png')
const serverConnection = new AttachmentBuilder('./server/assets/images/server_verbindung.png') export const serverConnection = new AttachmentBuilder('./server/assets/images/server_verbindung.png')
const accountChoice = new AttachmentBuilder('./server/assets/images/auswahl_anmeldung.png') export const accountChoice = new AttachmentBuilder('./server/assets/images/auswahl_anmeldung.png')
const loginScreen = new AttachmentBuilder('./server/assets/images/login_screen.png') export const loginScreen = new AttachmentBuilder('./server/assets/images/login_screen.png')
const overview = new AttachmentBuilder('./server/assets/images/jellyfin_ubersicht.png') export const overview = new AttachmentBuilder('./server/assets/images/jellyfin_ubersicht.png')
const joingroup = new AttachmentBuilder('./server/assets/images/gruppe_beitreten.png') export const joingroup = new AttachmentBuilder('./server/assets/images/gruppe_beitreten.png')
const resume = new AttachmentBuilder('./server/assets/images/wiedergabe_fortsetzen.png') export const resume = new AttachmentBuilder('./server/assets/images/wiedergabe_fortsetzen.png')
const leavegroup = new AttachmentBuilder('./server/assets/images/gruppe_verlassen.png') export const leavegroup = new AttachmentBuilder('./server/assets/images/gruppe_verlassen.png')
export const attachedImages = [splashScreen, startScreen, serverConnection, accountChoice, loginScreen, overview, resume, leavegroup, joingroup] export const attachedImages = [splashScreen, startScreen, serverConnection, accountChoice, loginScreen, overview, resume, leavegroup, joingroup]

View File

@ -1,9 +1,13 @@
import { Command } from '../structures/command' import { Command } from '../structures/command'
import { RunOptions } from '../types/commandTypes' import { RunOptions } from '../types/commandTypes'
import { APIEmbed, ActionRowBuilder, ButtonBuilder, ButtonStyle } from 'discord.js' import { APIEmbed, ActionRowBuilder, ButtonBuilder, ButtonComponent, ButtonInteraction, ButtonStyle, CollectorFilter, ComponentType, InteractionCollectorOptions } from 'discord.js'
import { v4 as uuid } from 'uuid' import { v4 as uuid } from 'uuid'
import { logger } from '../logger' import { logger } from '../logger'
import { CacheType } from 'discord.js'
import { configureServer, installation, loginInfo, useSyncgroup } from './mitgucken'
import { attachmentImages } from '../..'
import { accountChoice, joingroup, leavegroup, loginScreen, overview, resume, serverConnection, splashScreen, startScreen } from '../assets/attachments'
export default new Command({ export default new Command({
name: 'guides', name: 'guides',
@ -15,27 +19,69 @@ export default new Command({
logger.info(`Starting guides interaction for user ${interaction.interaction.user.id}`, { requestId, guildId }) logger.info(`Starting guides interaction for user ${interaction.interaction.user.id}`, { requestId, guildId })
const mediaPlayerGuideButton = new ButtonBuilder() const mediaPlayerGuideButton = new ButtonBuilder()
.setCustomId('jfmpGuide') .setCustomId('jfInstallation')
.setLabel('Media Player Einrichtung') .setLabel('Media Player Installation')
.setStyle(ButtonStyle.Primary) .setStyle(ButtonStyle.Primary)
const accountSetup = new ButtonBuilder() const accountSetupGuideButton = new ButtonBuilder()
.setCustomId('accountGuid') .setCustomId('configureServer')
.setLabel('Account Anlage') .setLabel('Server einstellen')
.setStyle(ButtonStyle.Primary)
const loginGuideButton = new ButtonBuilder()
.setCustomId('login')
.setLabel('Einloggen')
.setStyle(ButtonStyle.Primary)
const useSyncGroupGuideButton = new ButtonBuilder()
.setCustomId('useSyncGroup')
.setLabel('Watch Parties nutzen')
.setStyle(ButtonStyle.Primary)
const roleExplanationButton = new ButtonBuilder()
.setCustomId('explainRoles')
.setLabel('Wie bekomme ich Zugang')
.setStyle(ButtonStyle.Primary) .setStyle(ButtonStyle.Primary)
const row = new ActionRowBuilder<ButtonBuilder>() const row = new ActionRowBuilder<ButtonBuilder>()
.addComponents(mediaPlayerGuideButton, accountSetup) .addComponents(mediaPlayerGuideButton, accountSetupGuideButton, loginGuideButton, useSyncGroupGuideButton, roleExplanationButton)
//const userDMchannel = await interaction.interaction.user.createDM() //const userDMchannel = await interaction.interaction.user.createDM()
interaction.interaction.followUp({ const response = await interaction.interaction.followUp({
content: `Hier ist eine Auswahl von Guides.`, content: `Hier ist eine Auswahl von Guides.`,
components: [row] components: [row]
}) })
//userDMchannel.send({
// content: `Hier ist eine Auswahl von Guides.`, try {
// components: [row]
//}) const guideSelection = await response.awaitMessageComponent({ time: 60_000 })
if (guideSelection.customId === 'jfInstallation') {
const userDMChannel = await guideSelection.user.createDM()
userDMChannel.send({ embeds: installation(), files: [splashScreen] })
} else if (guideSelection.customId === 'configureServer') {
const userDMChannel = await guideSelection.user.createDM()
userDMChannel.send({ embeds: configureServer(), files: [startScreen, serverConnection] })
} else if (guideSelection.customId === 'login') {
const userDMChannel = await guideSelection.user.createDM()
userDMChannel.send({ embeds: loginInfo(), files: [accountChoice, loginScreen] })
} else if (guideSelection.customId === 'useSyncGroup') {
const userDMChannel = await guideSelection.user.createDM()
userDMChannel.send({ embeds: useSyncgroup(), files: [overview, joingroup, resume, leavegroup] })
} else if (guideSelection.customId === 'explainRoles') {
const userDMChannel = await guideSelection.user.createDM()
userDMChannel.send(`Mit einer Rolle kann dafür gesorgt werden, dass du einen dauerhaften Account auf dem Mediaserver hast. Wende dich bei Bedarf an Samantha oder Markus.\n
Für eine watchparty bekommst du allerdings automatisch einen Account. Hierfür melde einfach Interesse an dem Event an. Wenn du für das Event Interesse angemeldet hast bekommst du automatisch beim Start des Events einen Benutzernamen und das dazugehörige Passwort zugesendet.\n
Hast du kein Interesse angemeldet bekommst du automatisch einen Nutzernamen und Passwort zugeschickt wenn du den Channel betrittst in dem das Event stattfindet.`)
}
guideSelection.update({ content: "Hab ich dir per DM geschickt :)", components: [] })
} catch (error) {
await interaction.interaction.editReply({ content: 'Das dauert mir zu lange, frag mich nochmal wenn du nen guide brauchst', components: [] });
}
} }
}) })

View File

@ -13,6 +13,21 @@ export default new Command({
run: async (interaction: RunOptions) => { run: async (interaction: RunOptions) => {
const requestId = uuid() const requestId = uuid()
interaction.interaction.followUp('Ich schicke dir einen Guide per DM!') interaction.interaction.followUp('Ich schicke dir einen Guide per DM!')
const embedList: APIEmbed[] = []
embedList.push.apply(installation())
embedList.push.apply(configureServer())
embedList.push.apply(loginInfo())
embedList.push.apply(useSyncgroup())
//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: attachmentImages })
}
})
export function installation(): APIEmbed[] {
const embedList: APIEmbed[] = [] const embedList: APIEmbed[] = []
// DownloadLink // DownloadLink
embedList.push({ embedList.push({
@ -33,6 +48,11 @@ export default new Command({
url: 'attachment://set_splashscreen.png' url: 'attachment://set_splashscreen.png'
} }
}) })
return embedList
}
export function configureServer(): APIEmbed[] {
const embedList: APIEmbed[] = []
// Login // Login
embedList.push({ embedList.push({
color, color,
@ -54,6 +74,11 @@ export default new Command({
url: 'attachment://server_verbindung.png' url: 'attachment://server_verbindung.png'
} }
}) })
return embedList
}
export function loginInfo(): APIEmbed[] {
const embedList: APIEmbed[] = []
// Account choice // Account choice
embedList.push({ embedList.push({
color, color,
@ -62,16 +87,21 @@ export default new Command({
image: { image: {
url: 'attachment://auswahl_anmeldung.png' url: 'attachment://auswahl_anmeldung.png'
} }
}), })
// password screen // password screen
embedList.push({ embedList.push({
color, color,
title: "Login", title: "Login",
description: "Melde dich mit dem Usernamen und Passwort an, welches dir von mir zugeschickt wird.", description: "Melde dich mit dem Usernamen und Passwort an, welches dir von mir zugeschickt wird. Falls du ein neues brauchst führe einmal /reset_passwort aus :)",
image: { image: {
url: 'attachment://login_screen.png' url: 'attachment://login_screen.png'
} }
}) })
return embedList
}
export function useSyncgroup(): APIEmbed[] {
const embedList: APIEmbed[] = []
embedList.push({ embedList.push({
color, color,
title: "SyncPlay Menü", title: "SyncPlay Menü",
@ -98,7 +128,7 @@ export default new Command({
}, },
description: "Wenn du die Watchparty verlassen möchtest, kannst du das ebenfalls über das Menü oben rechts tun.", description: "Wenn du die Watchparty verlassen möchtest, kannst du das ebenfalls über das Menü oben rechts tun.",
}) })
// resume playback //resume playback
embedList.push({ embedList.push({
color, color,
title: "Wiedergabe fortsetzen", title: "Wiedergabe fortsetzen",
@ -107,9 +137,5 @@ 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.", 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 }) return embedList
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: attachmentImages})
}
})