Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow specifying a user for /srt and /rtmp #199

Merged
merged 1 commit into from
Jul 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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