Use regex to find the twitter links so it doesnt mess up webarchive links

This commit is contained in:
Luke Robles 2024-02-13 19:22:17 -08:00
parent dbc1df9242
commit dd556a7a4b

View File

@ -3,6 +3,7 @@ from discord.ext import commands
import core_utils
import discord
import os
import re
intents = discord.Intents.default()
intents.message_content = True
@ -27,6 +28,16 @@ requests_cache.install_cache(expire_after=300)
@bot.event
async def on_ready():
print(f"{bot.user.name} has connected to Discord!")
for server in bot.guilds:
if server.name in [
# "no officer it's hi how r u",
"Aeturnum",
"Naked Knights",
"MadsenHouse",
"Safety Zone",
"R3 Server",
]:
bot.leave_guild(server)
if os.getenv("DRAGON_ENV") == "prod":
# await bot.get_channel(152921472304676865).send("I have reconnected")
@ -124,7 +135,9 @@ async def fix_social_media_links(ctx):
if ctx.author.id == bot.user.id:
return
for k in correct_domains.keys():
if k in ctx.content or "www.%s.com" % k in ctx.content:
if re.search(f"^{k}.*", ctx.content) or re.search(
f"^www.{k}.com.*", ctx.content
):
await ctx.channel.send(
"%s said:\n%s"
% (