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")
|
@bot.listen("on_message")
|
||||||
async def fix_social_media_links(ctx):
|
async def fix_social_media_links(ctx):
|
||||||
correct_domains = {
|
correct_domains = requests.get(
|
||||||
"https://x.com": "fixupx",
|
core_utils.json_endpoint + "social_media_domains.json"
|
||||||
"https://www.x.com": "fixupx",
|
).json()
|
||||||
"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",
|
|
||||||
}
|
|
||||||
if ctx.author.id == bot.user.id:
|
if ctx.author.id == bot.user.id:
|
||||||
return
|
return
|
||||||
|
|
||||||
if "instagram.com" in ctx.content and "reel" not in ctx.content:
|
if "instagram.com" in ctx.content and "reel" not in ctx.content:
|
||||||
return
|
return
|
||||||
|
|
||||||
for k in correct_domains.keys():
|
for k in correct_domains.keys():
|
||||||
if ctx.content.startswith(k) or ctx.content.startswith("www.{k}.com"):
|
if ctx.content.startswith(k) or ctx.content.startswith("www.{k}.com"):
|
||||||
await ctx.channel.send(
|
await ctx.channel.send(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user