Skip to content

Commit

Permalink
Update messageCreate.js
Browse files Browse the repository at this point in the history
  • Loading branch information
hchoki authored Jan 22, 2024
1 parent eac1660 commit afef602
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion events/messageCreate.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,14 @@ module.exports = (client, message) => {
const linkRegex = /https?:\/\/(www\.)?(twitter\.com|x\.com)\/[^\s]+/g;
const foundLinks = message.content.match(linkRegex);

if (message.embeds.length === 0 && foundLinks) {
if (foundLinks) {
let replyText = '';
for (let link of foundLinks) {
link = link.replace(/(twitter\.com|x\.com)/, 'vxtwitter.com');
link = link.replace(/\/photo\/\d+$/, '');
replyText += `${link}\n`;
}
message.suppressEmbeds(true);
message.reply(replyText);
}

Expand Down

0 comments on commit afef602

Please sign in to comment.