Move social media domain corrections out of the bot so they can be updated out of band
This commit is contained in:
parent
399f09bf28
commit
969d9cb06b
15
app/bot.py
15
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(
|
||||
|
Loading…
x
Reference in New Issue
Block a user