Add posts info on reply
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

This commit is contained in:
SebClem 2024-01-25 11:13:49 +01:00
parent 1900355cf2
commit 311baa21e0
2 changed files with 14 additions and 3 deletions

View File

@ -9,7 +9,14 @@ IMAGE_NBR_LIMIT = 10
DEFAULT_UPLOAD_SIZE_LIMIT = 209715200
async def send_message(message: discord.Message, files, tmp_dir: str, muted: bool):
async def send_message(
message: discord.Message,
files,
tmp_dir: str,
muted: bool,
title: str,
art_author: str,
):
to_send_files = []
for file in files:
joined = os.path.join(tmp_dir, file)
@ -32,7 +39,8 @@ async def send_message(message: discord.Message, files, tmp_dir: str, muted: boo
to_send_files = to_send_files[1:]
elif first:
await message.reply(
files=splited_file, content=(TIPS_MESSAGE if not muted else None)
files=splited_file,
content=f"**{title}** by `{art_author}` {chr(10) + TIPS_MESSAGE if not muted else ''}",
)
first = False
else:

View File

@ -147,12 +147,15 @@ async def on_message(message: discord.Message):
)
if data is None:
return
(title, author) = data
files = os.listdir(tmp_dir)
files.sort()
# await send_message.send_message_with_embed(
# message, files, title, tmp_dir, match.group("url")
# )
await discord_tools.message.send_message(message, files, tmp_dir, muted)
await discord_tools.message.send_message(
message, files, tmp_dir, muted, title, author
)
client.run(DISCORD_TOKEN)