Merge pull request 'add guides' (#14) from buttons into master
Reviewed-on: #14
This commit is contained in:
commit
8f1c6e10fa
|
@ -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]
|
||||
|
|
|
@ -0,0 +1,83 @@
|
|||
|
||||
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, explainRoles, 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(explainRoles())
|
||||
}
|
||||
|
||||
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: [] });
|
||||
}
|
||||
|
||||
}
|
||||
})
|
|
@ -14,25 +14,44 @@ export default new Command({
|
|||
const requestId = uuid()
|
||||
interaction.interaction.followUp('Ich schicke dir einen Guide per DM!')
|
||||
const embedList: APIEmbed[] = []
|
||||
// DownloadLink
|
||||
embedList.push(...installation())
|
||||
embedList.push(...configureServer())
|
||||
embedList.push(...loginInfo())
|
||||
embedList.push(...useSyncgroup())
|
||||
embedList.push({
|
||||
color,
|
||||
title: 'Jellyfin Media Player',
|
||||
description: 'Du kannst den Jellyfin Media Player von github herunterladen.\n Der Mediaplayer muss genutzt werden, da ein Schauen direkt über das Webinterface den Server zum Schmelzen bringt.',
|
||||
title: "Wie du an einen Account kommst",
|
||||
description: explainRoles()
|
||||
})
|
||||
|
||||
//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 and installation
|
||||
embedList.push({
|
||||
color,
|
||||
title: 'Jellyfin Media Player Installation',
|
||||
description: 'Du kannst den Jellyfin Media Player von github herunterladen.\n Der Mediaplayer muss genutzt werden, da ein Schauen direkt über das Webinterface den Server zum Schmelzen bringt.\nFühre die Datei aus und installiere den Jellyfin Media Player an den Ort deiner Wahl.',
|
||||
fields: [
|
||||
{ name: "Windows", value: "https://github.com/jellyfin/jellyfin-media-player/releases/download/v1.9.1/JellyfinMediaPlayer-1.9.1-windows-x64.exe" },
|
||||
{ name: "Mac", value: "https://github.com/jellyfin/jellyfin-media-player/releases/download/v1.9.1/JellyfinMediaPlayer-1.9.1-macos-notarized.dmg" }
|
||||
]
|
||||
})
|
||||
// Installation
|
||||
embedList.push({
|
||||
color,
|
||||
title: "Installation",
|
||||
description: "Führe die Datei aus und installiere den Jellyfin Media Player an den Ort deiner Wahl",
|
||||
],
|
||||
image: {
|
||||
url: 'attachment://set_splashscreen.png'
|
||||
}
|
||||
})
|
||||
return embedList
|
||||
}
|
||||
|
||||
export function configureServer(): APIEmbed[] {
|
||||
const embedList: APIEmbed[] = []
|
||||
// Login
|
||||
embedList.push({
|
||||
color,
|
||||
|
@ -54,6 +73,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 +86,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 +136,11 @@ 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
|
||||
}
|
||||
|
||||
export function explainRoles(): string {
|
||||
return `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.`
|
||||
}
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue