Regex Take 2
This commit is contained in:
parent
a40017f53e
commit
0ca9cf0f80
2
bot.js
2
bot.js
@ -85,7 +85,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=)|(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 yturl = null;
|
||||||
var timestamp = '0'
|
var timestamp = '0'
|
||||||
if (ytmatch) {
|
if (ytmatch) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user