Fix in regular expressions for compat with ytdl-core.

This commit is contained in:
moosecrab 2022-06-09 16:45:45 -07:00
parent ea1c62b5b6
commit 4209113dc0

2
bot.js
View File

@ -152,7 +152,7 @@ client.on('message', async message => {
// Check for youtube play command // Check for youtube play command
const ytmatch = message.content.match(/(?<=!play (https?:\/\/)(www\.)?youtu((be\.com\/watch\?v=)|(\.be\/)))[\w-]{11}/); const ytmatch = message.content.match(/(?<=!play (https?:\/\/)(www\.)?youtu((be\.com\/watch\?v=)|(\.be\/)))[\w-]{11}/);
if (ytmatch && message.member.voice.channel) { if (ytmatch && message.member.voice.channel) {
const timematch = message.content.match(/t=(\d{1,2}h)?(\d{1,2}m)?\d{1,4}s?(?=$)/); const timematch = message.content.match(/(?<=t=)(\d{1,2}h)?(\d{1,2}m)?\d{1,4}s?(?=$)/);
var timestamp = '0'; var timestamp = '0';
if (timematch) { if (timematch) {
timestamp = timematch[0]; timestamp = timematch[0];