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"
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 splashScreen = new AttachmentBuilder('./server/assets/images/set_splashscreen.png')
export const startScreen = new AttachmentBuilder('./server/assets/images/start_screen.png')
export const serverConnection = new AttachmentBuilder('./server/assets/images/server_verbindung.png')
export const accountChoice = new AttachmentBuilder('./server/assets/images/auswahl_anmeldung.png')
export const loginScreen = new AttachmentBuilder('./server/assets/images/login_screen.png')
export const overview = new AttachmentBuilder('./server/assets/images/jellyfin_ubersicht.png')
export const joingroup = new AttachmentBuilder('./server/assets/images/gruppe_beitreten.png')
export const resume = new AttachmentBuilder('./server/assets/images/wiedergabe_fortsetzen.png')
export const leavegroup = new AttachmentBuilder('./server/assets/images/gruppe_verlassen.png')
export const attachedImages = [splashScreen, startScreen, serverConnection, accountChoice, loginScreen, overview, resume, leavegroup, joingroup]

View File

@ -1,9 +1,13 @@
import { Command } from '../structures/command'
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 { 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({
name: 'guides',
@ -15,27 +19,69 @@ export default new Command({
logger.info(`Starting guides interaction for user ${interaction.interaction.user.id}`, { requestId, guildId })
const mediaPlayerGuideButton = new ButtonBuilder()
.setCustomId('jfmpGuide')
.setLabel('Media Player Einrichtung')
.setCustomId('jfInstallation')
.setLabel('Media Player Installation')
.setStyle(ButtonStyle.Primary)
const accountSetup = new ButtonBuilder()
.setCustomId('accountGuid')
.setLabel('Account Anlage')
const accountSetupGuideButton = new ButtonBuilder()
.setCustomId('configureServer')
.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)
const row = new ActionRowBuilder<ButtonBuilder>()
.addComponents(mediaPlayerGuideButton, accountSetup)
.addComponents(mediaPlayerGuideButton, accountSetupGuideButton, loginGuideButton, useSyncGroupGuideButton, roleExplanationButton)
//const userDMchannel = await interaction.interaction.user.createDM()
interaction.interaction.followUp({
const response = await interaction.interaction.followUp({
content: `Hier ist eine Auswahl von Guides.`,
components: [row]
})
//userDMchannel.send({
// content: `Hier ist eine Auswahl von Guides.`,
// components: [row]
//})
try {
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) => {
const requestId = uuid()
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[] = []
// DownloadLink
embedList.push({
@ -33,6 +48,11 @@ export default new Command({
url: 'attachment://set_splashscreen.png'
}
})
return embedList
}
export function configureServer(): APIEmbed[] {
const embedList: APIEmbed[] = []
// Login
embedList.push({
color,
@ -54,6 +74,11 @@ export default new Command({
url: 'attachment://server_verbindung.png'
}
})
return embedList
}
export function loginInfo(): APIEmbed[] {
const embedList: APIEmbed[] = []
// Account choice
embedList.push({
color,
@ -62,16 +87,21 @@ export default new Command({
image: {
url: 'attachment://auswahl_anmeldung.png'
}
}),
})
// password screen
embedList.push({
color,
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: {
url: 'attachment://login_screen.png'
}
})
return embedList
}
export function useSyncgroup(): APIEmbed[] {
const embedList: APIEmbed[] = []
embedList.push({
color,
title: "SyncPlay Menü",
@ -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.",
})
//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})
return embedList
}
})