This commit is contained in:
Yamboy1 2019-12-27 10:33:26 +13:00
parent 1e201c46f6
commit c81c82506e

View file

@ -13,14 +13,11 @@ exports.lbrylink = async function(bot, msg, suffix) {
const urlOccurrences = (msg.content.match(/lbry:\/\//g) || []).length; const urlOccurrences = (msg.content.match(/lbry:\/\//g) || []).length;
if (urlOccurrences > 0) { if (urlOccurrences > 0) {
//convert all mentions to a plain string (because lbry://@Nikooo777 gets parsed as lbry://@<123123123> instead) //convert all mentions to a plain string (because lbry://@Nikooo777 gets parsed as lbry://@<123123123> instead)
const mentionRegex = /(.+)<@!?(\d{18})>(.+)/; const mentionRegex = /(.+)<@!?(\d{18})>(.+)/s;
let match; let match;
do { do {
if (match) { if (match) {
msg.content = msg.content = match[1] + `@${msg.guild.members.get(match[2]).user.username}` + match[3];
match[1] +
`@${msg.guild.members.get(match[2]).user.username}` +
match[3];
} }
match = msg.content.match(mentionRegex); match = msg.content.match(mentionRegex);
} while (match); } while (match);