Permit !play on /shorts/

Thanks @tks_ftw for helping confirm that short IDs and video IDs are in the same address space, and are interchangable
This commit is contained in:
Robert 2023-09-23 16:50:10 -07:00
parent 37027849fd
commit 3e7603412e

2
bot.js
View File

@ -130,7 +130,7 @@ client.on( Events.MessageCreate, async message => {
if (message.content.startsWith('!play') && message.member.voice.channel) { if (message.content.startsWith('!play') && message.member.voice.channel) {
console.log(`!play issued by ${message.author.tag} ${message.author.id}`); console.log(`!play issued by ${message.author.tag} ${message.author.id}`);
// Determine if we have a URL or a search term // Determine if we have a URL or a search term
const ytmatch = message.content.match(/(?<=(https?:\/\/)(www\.)?youtu((be\.com\/watch\?v=)|(\.be\/)))[\w-]{11,12}/); const ytmatch = message.content.match(/(?<=(https?:\/\/)(www\.)?youtu((be\.com\/(watch\?v=)|(shorts\/))|(\.be\/)))[\w-]{11,12}/);
var yturl = null; var yturl = null;
var timestamp = '0' var timestamp = '0'
if (ytmatch) { if (ytmatch) {