2023-06-09 16:16:23 +02:00
|
|
|
|
2023-06-09 22:01:38 +02:00
|
|
|
import { ActionRowBuilder, ButtonBuilder, ButtonStyle } from 'discord.js'
|
2023-06-09 16:16:23 +02:00
|
|
|
import { v4 as uuid } from 'uuid'
|
2023-06-09 21:30:24 +02:00
|
|
|
import { accountChoice, joingroup, leavegroup, loginScreen, overview, resume, serverConnection, splashScreen, startScreen } from '../assets/attachments'
|
2023-06-09 22:01:38 +02:00
|
|
|
import { logger } from '../logger'
|
|
|
|
import { Command } from '../structures/command'
|
|
|
|
import { RunOptions } from '../types/commandTypes'
|
2023-06-17 01:13:33 +02:00
|
|
|
import { configureServer, explainRole, installation, loginInfo, useSyncgroup } from './mitgucken'
|
2023-06-09 16:16:23 +02:00
|
|
|
|
|
|
|
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()
|
2023-06-09 21:30:24 +02:00
|
|
|
.setCustomId('jfInstallation')
|
|
|
|
.setLabel('Media Player Installation')
|
2023-06-09 16:16:23 +02:00
|
|
|
.setStyle(ButtonStyle.Primary)
|
|
|
|
|
2023-06-09 21:30:24 +02:00
|
|
|
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')
|
2023-06-09 16:16:23 +02:00
|
|
|
.setStyle(ButtonStyle.Primary)
|
|
|
|
|
|
|
|
|
|
|
|
const row = new ActionRowBuilder<ButtonBuilder>()
|
2023-06-09 21:30:24 +02:00
|
|
|
.addComponents(mediaPlayerGuideButton, accountSetupGuideButton, loginGuideButton, useSyncGroupGuideButton, roleExplanationButton)
|
|
|
|
|
2023-06-09 16:16:23 +02:00
|
|
|
|
|
|
|
//const userDMchannel = await interaction.interaction.user.createDM()
|
2023-06-09 21:30:24 +02:00
|
|
|
const response = await interaction.interaction.followUp({
|
2023-06-09 16:16:23 +02:00
|
|
|
content: `Hier ist eine Auswahl von Guides.`,
|
|
|
|
components: [row]
|
|
|
|
})
|
2023-06-09 21:30:24 +02:00
|
|
|
|
|
|
|
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()
|
2023-06-17 01:13:33 +02:00
|
|
|
userDMChannel.send({ embeds: explainRole() })
|
2023-06-09 21:30:24 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
guideSelection.update({ content: "Hab ich dir per DM geschickt :)", components: [] })
|
|
|
|
|
|
|
|
} catch (error) {
|
2023-06-09 22:01:38 +02:00
|
|
|
await interaction.interaction.editReply({ content: 'Das dauert mir zu lange, frag mich nochmal wenn du nen Guide brauchst', components: [] });
|
2023-06-09 21:30:24 +02:00
|
|
|
}
|
|
|
|
|
2023-06-09 16:16:23 +02:00
|
|
|
}
|
|
|
|
})
|