Skip to content

Commit

Permalink
/show: Remove extraneous button while broadcasting
Browse files Browse the repository at this point in the history
This isn't really necessary, was only ever a stopgap. We have an actual code fix for it now, so it's fine.
  • Loading branch information
mia-pi-git committed Aug 31, 2024
1 parent 4fe6617 commit abf66be
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
4 changes: 2 additions & 2 deletions server/chat-commands/info.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2631,7 +2631,7 @@ export const commands: Chat.ChatCommands = {
buf = Utils.html`<img src="${request.link}" width="${width}" height="${height}" />`;
if (resized) buf += Utils.html`<br /><a href="${request.link}" target="_blank">full-size image</a>`;
} else {
buf = await YouTube.generateVideoDisplay(request.link, false, true);
buf = await YouTube.generateVideoDisplay(request.link, false);
if (!buf) return this.errorReply('Could not get YouTube video');
}
buf += Utils.html`<br /><div class="infobox"><small>(Requested by ${request.name})</small>`;
Expand Down Expand Up @@ -2706,7 +2706,7 @@ export const commands: Chat.ChatCommands = {
this.runBroadcast();
let buf;
if (YouTube.linkRegex.test(link)) {
buf = await YouTube.generateVideoDisplay(link, false, this.broadcasting);
buf = await YouTube.generateVideoDisplay(link, false);
this.message = this.message.replace(/&ab_channel=(.*)(&|)/ig, '').replace(/https:\/\/www\./ig, '');
} else if (Twitch.linkRegex.test(link)) {
const channelId = Twitch.linkRegex.exec(link)?.[2]?.trim();
Expand Down
9 changes: 2 additions & 7 deletions server/chat-plugins/youtube.ts
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ export class YoutubeInterface {
if (id.includes('?')) id = id.split('?')[0];
return id;
}
async generateVideoDisplay(link: string, fullInfo = false, broadcasting = false) {
async generateVideoDisplay(link: string, fullInfo = false) {
if (!Config.youtubeKey) {
throw new Chat.ErrorMessage(`This server does not support YouTube commands. If you're the owner, you can enable them by setting up Config.youtubekey.`);
}
Expand All @@ -239,12 +239,7 @@ export class YoutubeInterface {
if (!fullInfo) {
let buf = `<b>${info.title}</b> `;
buf += `(<a class="subtle" href="https://youtube.com/channel/${info.channelUrl}">${info.channelTitle}</a>)<br />`;
if (broadcasting) {
buf += `<button class="button" name="send" value="/show https://www.youtube.com/watch?v=${id}">`;
buf += `Click to view "${info.title}"</button>`;
} else {
buf += `<youtube src="https://www.youtube.com/embed/${id}" />`;
}
buf += `<youtube src="https://www.youtube.com/embed/${id}" />`;
return buf;
}
let buf = `<table style="margin:0px;"><tr>`;
Expand Down

0 comments on commit abf66be

Please sign in to comment.