Skip to content

Commit

Permalink
Merge pull request #199 from zusorio/srt-rtmp-user-select
Browse files Browse the repository at this point in the history
Allow specifying a user for /srt and /rtmp
  • Loading branch information
slmnio authored Jul 19, 2023
2 parents e2adf5e + 4137309 commit 08732ed
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 5 additions & 1 deletion server/src/discord/commands/prod/rtmp.js
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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");
Expand Down
6 changes: 5 additions & 1 deletion server/src/discord/commands/prod/srt.js
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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");
Expand Down

0 comments on commit 08732ed

Please sign in to comment.