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
|
# https://github.com/psf/black/issues/1106#issuecomment-547230844
|
||||||
format:
|
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:
|
clean:
|
||||||
docker rm -f dragon-bot-test
|
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")
|
@bot.listen("on_message")
|
||||||
async def fix_social_media_links(ctx):
|
async def fix_social_media_links(ctx):
|
||||||
if "https://www.tiktok.com" in ctx.content:
|
correct_domains = {
|
||||||
await ctx.channel.send(
|
"https://x.com": "vxtwitter",
|
||||||
"%s said:\n%s"
|
"https://twitter.com": "vxtwitter",
|
||||||
% (
|
"https://tiktok.com": "vxtiktok",
|
||||||
ctx.author.mention,
|
}
|
||||||
ctx.content.replace("tiktok", "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()
|
||||||
await ctx.delete()
|
return
|
||||||
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
|
|
||||||
|
|
||||||
|
|
||||||
@bot.event
|
@bot.event
|
||||||
|
Loading…
x
Reference in New Issue
Block a user