Use regex to find the twitter links so it doesnt mess up webarchive links
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
caa2e37df9
commit
62d76dfa17
15
app/bot.py
15
app/bot.py
@ -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"
|
||||
% (
|
||||
|
Loading…
x
Reference in New Issue
Block a user