Making things cleaner, and fixing python formatter docker image
This commit is contained in:
parent
1e59e5561d
commit
6c758297e7
2
Makefile
2
Makefile
@ -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
|
||||
|
46
app/bot.py
46
app/bot.py
@ -115,38 +115,22 @@ 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:
|
||||
await ctx.channel.send(
|
||||
"%s said:\n%s"
|
||||
% (
|
||||
ctx.author.mention,
|
||||
ctx.content.replace("tiktok", "vxtiktok"),
|
||||
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(k, "https://%s.com" % correct_domains[k]),
|
||||
)
|
||||
)
|
||||
)
|
||||
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"),
|
||||
)
|
||||
)
|
||||
await ctx.delete()
|
||||
return
|
||||
await ctx.delete()
|
||||
return
|
||||
|
||||
|
||||
@bot.event
|
||||
|
Loading…
x
Reference in New Issue
Block a user