check for www or tiktok.com

This commit is contained in:
Luke Robles 2023-12-13 08:15:24 -08:00
parent 406d044d64
commit 787e44c6c8

View File

@ -116,18 +116,19 @@ 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 = {
"https://x.com": "vxtwitter", "x.com": "vxtwitter",
"https://twitter.com": "vxtwitter", "twitter.com": "vxtwitter",
"https://tiktok.com": "vxtiktok", "tiktok.com": "vxtiktok",
"https://www.tiktok.com": "vxtiktok",
} }
if ctx.author.id == bot.user.id:
return
for k in correct_domains.keys(): for k in correct_domains.keys():
if k in ctx.content: if k in ctx.content or "www.%s.com" % k in ctx.content:
await ctx.channel.send( await ctx.channel.send(
"%s said:\n%s" "%s said:\n%s"
% ( % (
ctx.author.mention, ctx.author.mention,
ctx.content.replace(k, "https://%s.com" % correct_domains[k]), ctx.content.replace(k, "%s.com" % correct_domains[k]),
) )
) )
await ctx.delete() await ctx.delete()