88 lines
4.2 KiB
TypeScript
88 lines
4.2 KiB
TypeScript
|
|
import { Command } from '../structures/command'
|
|
import { RunOptions } from '../types/commandTypes'
|
|
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',
|
|
description: 'Bekomme eine Auswahl von Guides per DM',
|
|
options: [],
|
|
run: async (interaction: RunOptions) => {
|
|
const requestId = uuid()
|
|
const guildId = interaction.interaction.guild?.id
|
|
logger.info(`Starting guides interaction for user ${interaction.interaction.user.id}`, { requestId, guildId })
|
|
|
|
const mediaPlayerGuideButton = new ButtonBuilder()
|
|
.setCustomId('jfInstallation')
|
|
.setLabel('Media Player Installation')
|
|
.setStyle(ButtonStyle.Primary)
|
|
|
|
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, accountSetupGuideButton, loginGuideButton, useSyncGroupGuideButton, roleExplanationButton)
|
|
|
|
|
|
//const userDMchannel = await interaction.interaction.user.createDM()
|
|
const response = await interaction.interaction.followUp({
|
|
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: [] });
|
|
}
|
|
|
|
}
|
|
})
|