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"
|
import { AttachmentBuilder } from "discord.js"
|
||||||
|
|
||||||
const splashScreen = new AttachmentBuilder('./server/assets/images/set_splashscreen.png')
|
export const splashScreen = new AttachmentBuilder('./server/assets/images/set_splashscreen.png')
|
||||||
const startScreen = new AttachmentBuilder('./server/assets/images/start_screen.png')
|
export const startScreen = new AttachmentBuilder('./server/assets/images/start_screen.png')
|
||||||
const serverConnection = new AttachmentBuilder('./server/assets/images/server_verbindung.png')
|
export const serverConnection = new AttachmentBuilder('./server/assets/images/server_verbindung.png')
|
||||||
const accountChoice = new AttachmentBuilder('./server/assets/images/auswahl_anmeldung.png')
|
export const accountChoice = new AttachmentBuilder('./server/assets/images/auswahl_anmeldung.png')
|
||||||
const loginScreen = new AttachmentBuilder('./server/assets/images/login_screen.png')
|
export const loginScreen = new AttachmentBuilder('./server/assets/images/login_screen.png')
|
||||||
const overview = new AttachmentBuilder('./server/assets/images/jellyfin_ubersicht.png')
|
export const overview = new AttachmentBuilder('./server/assets/images/jellyfin_ubersicht.png')
|
||||||
const joingroup = new AttachmentBuilder('./server/assets/images/gruppe_beitreten.png')
|
export const joingroup = new AttachmentBuilder('./server/assets/images/gruppe_beitreten.png')
|
||||||
const resume = new AttachmentBuilder('./server/assets/images/wiedergabe_fortsetzen.png')
|
export const resume = new AttachmentBuilder('./server/assets/images/wiedergabe_fortsetzen.png')
|
||||||
const leavegroup = new AttachmentBuilder('./server/assets/images/gruppe_verlassen.png')
|
export const leavegroup = new AttachmentBuilder('./server/assets/images/gruppe_verlassen.png')
|
||||||
export const attachedImages = [splashScreen, startScreen, serverConnection, accountChoice, loginScreen, overview, resume, leavegroup, joingroup]
|
export const attachedImages = [splashScreen, startScreen, serverConnection, accountChoice, loginScreen, overview, resume, leavegroup, joingroup]
|
||||||
|
83
server/commands/guides.ts
Normal file
83
server/commands/guides.ts
Normal file
@ -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,102 +14,133 @@ export default new Command({
|
|||||||
const requestId = uuid()
|
const requestId = uuid()
|
||||||
interaction.interaction.followUp('Ich schicke dir einen Guide per DM!')
|
interaction.interaction.followUp('Ich schicke dir einen Guide per DM!')
|
||||||
const embedList: APIEmbed[] = []
|
const embedList: APIEmbed[] = []
|
||||||
// DownloadLink
|
embedList.push(...installation())
|
||||||
|
embedList.push(...configureServer())
|
||||||
|
embedList.push(...loginInfo())
|
||||||
|
embedList.push(...useSyncgroup())
|
||||||
embedList.push({
|
embedList.push({
|
||||||
color,
|
color,
|
||||||
title: 'Jellyfin Media Player',
|
title: "Wie du an einen Account kommst",
|
||||||
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.',
|
description: explainRoles()
|
||||||
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'
|
|
||||||
}
|
|
||||||
})
|
|
||||||
// Login
|
|
||||||
embedList.push({
|
|
||||||
color,
|
|
||||||
title: "Server Auswahl",
|
|
||||||
description: "Die Jellyfin App kann sich mit mehreren Servern verbinden.\n Hattest du noch nie eine Server Verbindung wähle hier 'Server hinzufügen'.",
|
|
||||||
image: {
|
|
||||||
url: 'attachment://start_screen.png'
|
|
||||||
}
|
|
||||||
})
|
|
||||||
// Server Address
|
|
||||||
embedList.push({
|
|
||||||
color,
|
|
||||||
title: "Server Verbindung",
|
|
||||||
description: "Stelle eine Verbindung zum Hartzarett Jellyfin Server her",
|
|
||||||
fields: [
|
|
||||||
{ name: "Server Adresse", value: "https://media.hartzarett.ruhr" }
|
|
||||||
],
|
|
||||||
image: {
|
|
||||||
url: 'attachment://server_verbindung.png'
|
|
||||||
}
|
|
||||||
})
|
|
||||||
// Account choice
|
|
||||||
embedList.push({
|
|
||||||
color,
|
|
||||||
title: "Account Auswahl",
|
|
||||||
description: "In der Regel sind die Accounts aus Datenschutzgründen versteckt.\nWähle 'Manuelle Anmeldung' aus",
|
|
||||||
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.",
|
|
||||||
image: {
|
|
||||||
url: 'attachment://login_screen.png'
|
|
||||||
}
|
|
||||||
})
|
|
||||||
embedList.push({
|
|
||||||
color,
|
|
||||||
title: "SyncPlay Menü",
|
|
||||||
image: {
|
|
||||||
url: 'attachment://jellyfin_ubersicht.png'
|
|
||||||
},
|
|
||||||
description: "Im Hauptbildschirm findest du die 'SyncPlay' Einstellungen oben rechts.",
|
|
||||||
})
|
|
||||||
// join group
|
|
||||||
embedList.push({
|
|
||||||
color,
|
|
||||||
title: "Gruppe beitreten",
|
|
||||||
image: {
|
|
||||||
url: 'attachment://gruppe_beitreten.png'
|
|
||||||
},
|
|
||||||
description: "Suche dir aus dem Dropdown die SyncPlay Gruppe aus, die zu deinem Event gehört.",
|
|
||||||
})
|
|
||||||
// leave group
|
|
||||||
embedList.push({
|
|
||||||
color,
|
|
||||||
title: "Gruppe verlassen",
|
|
||||||
image: {
|
|
||||||
url: 'attachment://gruppe_verlassen.png'
|
|
||||||
},
|
|
||||||
description: "Wenn du die Watchparty verlassen möchtest, kannst du das ebenfalls über das Menü oben rechts tun.",
|
|
||||||
})
|
|
||||||
// resume playback
|
|
||||||
embedList.push({
|
|
||||||
color,
|
|
||||||
title: "Wiedergabe fortsetzen",
|
|
||||||
image: {
|
|
||||||
url: 'attachment://wiedergabe_fortsetzen.png'
|
|
||||||
},
|
|
||||||
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(`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 })
|
logger.info(`Sending guide to ${interaction.interaction.user.id}`, { requestId, guildId: interaction.interaction.guild?.id })
|
||||||
const userDMchannel = await interaction.interaction.user.createDM()
|
const userDMchannel = await interaction.interaction.user.createDM()
|
||||||
userDMchannel.send({ embeds: embedList, files: attachmentImages})
|
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" }
|
||||||
|
],
|
||||||
|
image: {
|
||||||
|
url: 'attachment://set_splashscreen.png'
|
||||||
|
}
|
||||||
|
})
|
||||||
|
return embedList
|
||||||
|
}
|
||||||
|
|
||||||
|
export function configureServer(): APIEmbed[] {
|
||||||
|
const embedList: APIEmbed[] = []
|
||||||
|
// Login
|
||||||
|
embedList.push({
|
||||||
|
color,
|
||||||
|
title: "Server Auswahl",
|
||||||
|
description: "Die Jellyfin App kann sich mit mehreren Servern verbinden.\n Hattest du noch nie eine Server Verbindung wähle hier 'Server hinzufügen'.",
|
||||||
|
image: {
|
||||||
|
url: 'attachment://start_screen.png'
|
||||||
|
}
|
||||||
|
})
|
||||||
|
// Server Address
|
||||||
|
embedList.push({
|
||||||
|
color,
|
||||||
|
title: "Server Verbindung",
|
||||||
|
description: "Stelle eine Verbindung zum Hartzarett Jellyfin Server her",
|
||||||
|
fields: [
|
||||||
|
{ name: "Server Adresse", value: "https://media.hartzarett.ruhr" }
|
||||||
|
],
|
||||||
|
image: {
|
||||||
|
url: 'attachment://server_verbindung.png'
|
||||||
|
}
|
||||||
|
})
|
||||||
|
return embedList
|
||||||
|
}
|
||||||
|
|
||||||
|
export function loginInfo(): APIEmbed[] {
|
||||||
|
const embedList: APIEmbed[] = []
|
||||||
|
// Account choice
|
||||||
|
embedList.push({
|
||||||
|
color,
|
||||||
|
title: "Account Auswahl",
|
||||||
|
description: "In der Regel sind die Accounts aus Datenschutzgründen versteckt.\nWähle 'Manuelle Anmeldung' aus",
|
||||||
|
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. 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ü",
|
||||||
|
image: {
|
||||||
|
url: 'attachment://jellyfin_ubersicht.png'
|
||||||
|
},
|
||||||
|
description: "Im Hauptbildschirm findest du die 'SyncPlay' Einstellungen oben rechts.",
|
||||||
|
})
|
||||||
|
// join group
|
||||||
|
embedList.push({
|
||||||
|
color,
|
||||||
|
title: "Gruppe beitreten",
|
||||||
|
image: {
|
||||||
|
url: 'attachment://gruppe_beitreten.png'
|
||||||
|
},
|
||||||
|
description: "Suche dir aus dem Dropdown die SyncPlay Gruppe aus, die zu deinem Event gehört.",
|
||||||
|
})
|
||||||
|
// leave group
|
||||||
|
embedList.push({
|
||||||
|
color,
|
||||||
|
title: "Gruppe verlassen",
|
||||||
|
image: {
|
||||||
|
url: 'attachment://gruppe_verlassen.png'
|
||||||
|
},
|
||||||
|
description: "Wenn du die Watchparty verlassen möchtest, kannst du das ebenfalls über das Menü oben rechts tun.",
|
||||||
|
})
|
||||||
|
//resume playback
|
||||||
|
embedList.push({
|
||||||
|
color,
|
||||||
|
title: "Wiedergabe fortsetzen",
|
||||||
|
image: {
|
||||||
|
url: 'attachment://wiedergabe_fortsetzen.png'
|
||||||
|
},
|
||||||
|
description: "Wenn du aus der Watchparty rausgeflogen bist, oder die Wiedergabe verlassen hast, kannst du über das Menü oben rechts auch wieder zurückkehren.",
|
||||||
|
})
|
||||||
|
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
Block a user