From 969d9cb06beaaee06009d1d7a472e62862f9811c Mon Sep 17 00:00:00 2001 From: Luke Robles Date: Fri, 1 Nov 2024 19:14:45 -0700 Subject: [PATCH] Move social media domain corrections out of the bot so they can be updated out of band --- app/bot.py | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/app/bot.py b/app/bot.py index eeef1d8d..d3db539a 100755 --- a/app/bot.py +++ b/app/bot.py @@ -88,19 +88,16 @@ async def convert_heic_to_jpg(ctx): @bot.listen("on_message") async def fix_social_media_links(ctx): - correct_domains = { - "https://x.com": "fixupx", - "https://www.x.com": "fixupx", - "https://twitter.com": "fixupx", - "https://www.twitter.com": "fixupx", - "https://www.reddit.com": "rxddit", - "https://old.reddit.com": "rxddit", - "https://www.instagram.com": "d.ddinstagram", - } + correct_domains = requests.get( + core_utils.json_endpoint + "social_media_domains.json" + ).json() + if ctx.author.id == bot.user.id: return + if "instagram.com" in ctx.content and "reel" not in ctx.content: return + for k in correct_domains.keys(): if ctx.content.startswith(k) or ctx.content.startswith("www.{k}.com"): await ctx.channel.send(