diff --git a/src/backend/chat/commands/builtin/quotes.ts b/src/backend/chat/commands/builtin/quotes.ts index cea9edece..65d0af3af 100644 --- a/src/backend/chat/commands/builtin/quotes.ts +++ b/src/backend/chat/commands/builtin/quotes.ts @@ -12,6 +12,7 @@ export const QuotesManagementSystemCommand: SystemCommand<{ quoteDisplayTemplate: string; quoteDateFormat: string; useTTS: boolean; + defaultStreamerAttribution: boolean; }> = { definition: { id: "firebot:quotesmanagement", @@ -50,6 +51,12 @@ export const QuotesManagementSystemCommand: SystemCommand<{ title: "Read Quotes via TTS", description: "Have quotes read by TTS whenever one is created or looked up.", default: false + }, + defaultStreamerAttribution: { + type: "boolean", + title: "Attribute new quote to streamer if nobody is explicitly tagged with @", + description: "If @username is not included when adding a quote, it is attributed to the streamer.", + default: false } }, subCommands: [ @@ -270,14 +277,24 @@ export const QuotesManagementSystemCommand: SystemCommand<{ switch (triggeredArg) { case "add": { - if (args.length < 3) { - await twitchChat.sendChatMessage(`Please provide some quote text!`); - return resolve(); + const shouldInsertStreamerUsername = (commandOptions.defaultStreamerAttribution && args.length === 1) + || (commandOptions.defaultStreamerAttribution && !args[1].includes("@")); + const expectedArgs = shouldInsertStreamerUsername + ? 2 + : 3; + + if (args.length < expectedArgs) { + await twitchChat.sendChatMessage(`Please provide some quote text!`); + return resolve(); } - + // Once we've evaluated that the syntax is correct we make our API calls const channelData = await TwitchApi.channels.getChannelInformation(); - const currentGameName = channelData && channelData.gameName ? channelData.gameName : "Unknown game"; + + // If shouldInsertStreamerUsername and no @ is included in the originator arg, set originator @streamerName and treat the rest as the quote + if (shouldInsertStreamerUsername) { + args.splice(1,0,`@${channelData.displayName}`) + } const newQuote = { text: args.slice(2, args.length).join(" "), @@ -597,4 +614,4 @@ export const QuotesManagementSystemCommand: SystemCommand<{ } }); } -}; \ No newline at end of file +}; diff --git a/src/backend/effects/builtin/clips.js b/src/backend/effects/builtin/clips.js index 5f4c42cc3..6adb4150d 100644 --- a/src/backend/effects/builtin/clips.js +++ b/src/backend/effects/builtin/clips.js @@ -211,7 +211,7 @@ const clip = { } webServer.sendToOverlay("playTwitchClip", { - clipSlug: clip.id, + clipVideoUrl: clip.embedUrl, width: effect.width, height: effect.height, duration: clipDuration, @@ -277,18 +277,19 @@ const clip = { rotation } = event; - const styles = (width ? `width: ${width}px;` : '') + - (height ? `height: ${height}px;` : '') + - (rotation ? `transform: rotate(${rotation});` : ''); + // eslint-disable-next-line prefer-template + const styles = `width: ${width || screen.width}px; + height: ${height || screen.height}px; + transform: rotate(${rotation || 0});`; const videoElement = ` -