Regex Take 2

This commit is contained in:
Robert 2023-09-23 17:26:30 -07:00
parent a40017f53e
commit 0ca9cf0f80

2
bot.js
View File

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