Skip to content

Commit

Permalink
Add support to rewrite 𝕏.
Browse files Browse the repository at this point in the history
  • Loading branch information
skiman6010 committed Nov 16, 2023
1 parent 7b585ac commit ebf2598
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/embeds_bot/gimme_embeds.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,17 @@ def edit_text(self, text, chat_id):
insensitive_twitter = re.compile(re.escape("twitter.com"), re.IGNORECASE)
new_url = insensitive_twitter.sub("vxtwitter.com", twitter_url)
new_url = new_url.split("?")[0] # Remove trackers

elif re.search(r"(?P<url>x.com/(.*?)/[^\s]+)", text, re.IGNORECASE) and database["twitter"] == "1":
# Isolate the 𝕏, formerly known as Twitter, URL.
twitter_url = str(
re.search(
r"(?P<url>([^\s]*?)x.com[^\s]+)", text, re.IGNORECASE
).group("url")
)
insensitive_twitter = re.compile(re.escape("x.com"), re.IGNORECASE)
new_url = insensitive_twitter.sub("vxtwitter.com", twitter_url)
new_url = new_url.split("?")[0]

# For TikTok
elif (
Expand Down

0 comments on commit ebf2598

Please sign in to comment.