From 41373090532df81c3ed84564c89387c71f42c46a Mon Sep 17 00:00:00 2001 From: Tobias Messner Date: Wed, 19 Jul 2023 17:17:15 +0200 Subject: [PATCH] Allow specifying a user for /srt and /rtmp --- server/src/discord/commands/prod/rtmp.js | 6 +++++- server/src/discord/commands/prod/srt.js | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/server/src/discord/commands/prod/rtmp.js b/server/src/discord/commands/prod/rtmp.js index e2605ee6..da70814c 100644 --- a/server/src/discord/commands/prod/rtmp.js +++ b/server/src/discord/commands/prod/rtmp.js @@ -10,6 +10,8 @@ module.exports = { .setName("rtmp") .addStringOption(option => option.setName("feed").setDescription("Name of the feed")) + .addUserOption(option => + option.setName("user").setDescription("User to get the feed of")) .addStringOption(option => option.setName("region") .setDescription("RTMP server region") @@ -28,8 +30,10 @@ module.exports = { await interaction.deferReply(); let feedId = interaction.options.getString("feed")?.toLocaleLowerCase(); + let targetUser = interaction.options.getUser("user") ?? interaction.user; + if (!feedId) { - let targetPlayer = await Cache.auth.getPlayer(interaction.user.id); + let targetPlayer = await Cache.auth.getPlayer(targetUser.id); let playerClient = await Cache.get(targetPlayer?.clients?.[0]); if (!playerClient || !playerClient?.key) { return interaction.followUp("Couldn't find a feed"); diff --git a/server/src/discord/commands/prod/srt.js b/server/src/discord/commands/prod/srt.js index 6f2f522c..431e8723 100644 --- a/server/src/discord/commands/prod/srt.js +++ b/server/src/discord/commands/prod/srt.js @@ -10,6 +10,8 @@ module.exports = { .setName("srt") .addStringOption(option => option.setName("feed").setDescription("Name of the feed")) + .addUserOption(option => + option.setName("user").setDescription("User to get the feed of")) .addStringOption(option => option.setName("region") .setDescription("SRT server region") @@ -37,8 +39,10 @@ module.exports = { await interaction.deferReply(); let feedId = interaction.options.getString("feed")?.toLocaleLowerCase(); + let targetUser = interaction.options.getUser("user") ?? interaction.user; + if (!feedId) { - let targetPlayer = await Cache.auth.getPlayer(interaction.user.id); + let targetPlayer = await Cache.auth.getPlayer(targetUser.id); let playerClient = await Cache.get(targetPlayer?.clients?.[0]); if (!playerClient || !playerClient?.key) { return interaction.followUp("Couldn't find a feed");