mightypanders
26c2d91252
All checks were successful
Build a docker image for node-jellyfin-role-bot / build-docker-image (push) Successful in 1m16s
- reorder account acquisition in front of login - rebox explainrole function - adjust external reference to function
84 lines
3.5 KiB
TypeScript
84 lines
3.5 KiB
TypeScript
|
|
import { ActionRowBuilder, ButtonBuilder, ButtonStyle } from 'discord.js'
|
|
import { v4 as uuid } from 'uuid'
|
|
import { accountChoice, joingroup, leavegroup, loginScreen, overview, resume, serverConnection, splashScreen, startScreen } from '../assets/attachments'
|
|
import { logger } from '../logger'
|
|
import { Command } from '../structures/command'
|
|
import { RunOptions } from '../types/commandTypes'
|
|
import { configureServer, explainRole, installation, loginInfo, useSyncgroup } from './mitgucken'
|
|
|
|
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({ embeds: explainRole() })
|
|
}
|
|
|
|
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: [] });
|
|
}
|
|
|
|
}
|
|
})
|