Skip to content

Commit

Permalink
Handle Twitter usernames with underscores
Browse files Browse the repository at this point in the history
  • Loading branch information
Shadowfiend authored Jan 9, 2024
1 parent a2ed4ec commit 1f7d616
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions discord-scripts/fix-twitter-embed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ async function workingTwitterEmbeds(

if (!message.author.bot) {
const content = message.content ?? ""
if (content.match(/(https:\/\/(x|twitter).com\/[a-zA-Z0-9%/+]+)/)) {
if (content.match(/(https:\/\/(x|twitter).com\/[a-zA-Z0-9%/_+]+)/)) {
const allLinks = Array.from(
content.matchAll(/(https:\/\/(x|twitter).com\/[a-zA-Z0-9%/+]+)/g),
content.matchAll(/(https:\/\/(x|twitter).com\/[a-zA-Z0-9%/_+]+)/g),
)
.map(([twitterLink]) =>
twitterLink.replace(/https:\/\/(x|twitter)/, "https://fxtwitter"),
Expand Down

0 comments on commit 1f7d616

Please sign in to comment.