Skip to content

Commit

Permalink
Add webgl flag
Browse files Browse the repository at this point in the history
  • Loading branch information
rjt-rockx committed Nov 23, 2022
1 parent 2bc2a2b commit 251b31b
Showing 1 changed file with 9 additions and 17 deletions.
26 changes: 9 additions & 17 deletions bot/commands/start.ts
Original file line number Diff line number Diff line change
@@ -1,4 1,3 @@
import { Session } from "@prisma/client";
// import { time } from "discord.js";
import { CommandContext, CommandOptionType, SlashCommand, SlashCreator } from "slash-create";

Expand Down Expand Up @@ -48,17 47,24 @@ export default class Start extends SlashCommand<BotClient> {
} as StartSessionOptions;

const extraOptions = ctx.options.extra?.split(" ") ?? [];
const features: string[] = [];
if (extraOptions.includes("--1080p")) {
options.width = 1920;
options.height = 1080;
features.push("1080p");
}
if (extraOptions.includes("--60fps")) {
options.fps = 60;
features.push("60fps");
}
if (extraOptions.includes("--webgl")) {
options.webgl = true;
features.push("WebGL");
}
if (extraOptions.includes("--kiosk")) {
options.kiosk = true;
features.push("Kiosk");
}

const session = await createSession(options);
await ctx.send({
embeds: [
Expand All @@ -68,7 74,7 @@ export default class Start extends SlashCommand<BotClient> {
description: [
"Share this link to browse together -",
`${process.env.VITE_CLIENT_BASE_URL}/${session.url}`,
this.getFeatures(session, options),
`(${[regions[session.region || "NA"], ...features].join(", ")})`,
"",
`[GitHub](${process.env.VITE_GITHUB_URL}) • [Support](${process.env.VITE_DISCORD_SUPPORT_SERVER})`,
].join("\n"),
Expand Down Expand Up @@ -127,18 133,4 @@ export default class Start extends SlashCommand<BotClient> {
});
}
}

getFeatures(session: Session, options: StartSessionOptions) {
const features: string[] = [];
features.push(regions[session.region || "NA"]);

if (options.width === 1920 && options.height === 1080) {
features.push("1080p");
} else {
features.push("720p");
}
if (options.fps === 60) features.push("60fps");
if (options.kiosk) features.push("kiosk");
return `(${features.join(", ")})`;
}
}

0 comments on commit 251b31b

Please sign in to comment.