Making things cleaner, and fixing python formatter docker image

This commit is contained in:
Luke Robles 2023-12-12 10:54:25 -08:00
parent 1e59e5561d
commit 6c758297e7
2 changed files with 16 additions and 32 deletions

View File

@ -2,7 +2,7 @@ include .env
# https://github.com/psf/black/issues/1106#issuecomment-547230844
format:
docker run --rm -ti -v ${PWD}:/tmp/python/app python:alpine sh -c "apk add --no-cache gcc musl-dev; cd /tmp/python; pip install -q black; black ."
docker run --rm -ti -v ${PWD}:/tmp/python/app pyfound/black:latest_release sh -c "black /tmp/python"
clean:
docker rm -f dragon-bot-test

View File

@ -115,34 +115,18 @@ async def convert_heic_to_jpg(ctx):
@bot.listen("on_message")
async def fix_social_media_links(ctx):
if "https://www.tiktok.com" in ctx.content:
correct_domains = {
"https://x.com": "vxtwitter",
"https://twitter.com": "vxtwitter",
"https://tiktok.com": "vxtiktok",
}
for k in correct_domains.keys():
if k in ctx.content:
await ctx.channel.send(
"%s said:\n%s"
% (
ctx.author.mention,
ctx.content.replace("tiktok", "vxtiktok"),
)
)
await ctx.delete()
return
if "https://twitter.com" in ctx.content:
await ctx.channel.send(
"%s said:\n%s"
% (
ctx.author.mention,
ctx.content.replace("twitter", "vxtwitter"),
)
)
await ctx.delete()
return
if "https://x.com" in ctx.content:
await ctx.channel.send(
"%s said:\n%s"
% (
ctx.author.mention,
ctx.content.replace("x", "vxtwitter"),
ctx.content.replace(k, "https://%s.com" % correct_domains[k]),
)
)
await ctx.delete()