Add posts info on reply
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
This commit is contained in:
parent
1900355cf2
commit
311baa21e0
@ -9,7 +9,14 @@ IMAGE_NBR_LIMIT = 10
|
|||||||
DEFAULT_UPLOAD_SIZE_LIMIT = 209715200
|
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 = []
|
to_send_files = []
|
||||||
for file in files:
|
for file in files:
|
||||||
joined = os.path.join(tmp_dir, file)
|
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:]
|
to_send_files = to_send_files[1:]
|
||||||
elif first:
|
elif first:
|
||||||
await message.reply(
|
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
|
first = False
|
||||||
else:
|
else:
|
||||||
|
@ -147,12 +147,15 @@ async def on_message(message: discord.Message):
|
|||||||
)
|
)
|
||||||
if data is None:
|
if data is None:
|
||||||
return
|
return
|
||||||
|
(title, author) = data
|
||||||
files = os.listdir(tmp_dir)
|
files = os.listdir(tmp_dir)
|
||||||
files.sort()
|
files.sort()
|
||||||
# await send_message.send_message_with_embed(
|
# await send_message.send_message_with_embed(
|
||||||
# message, files, title, tmp_dir, match.group("url")
|
# 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)
|
client.run(DISCORD_TOKEN)
|
||||||
|
Loading…
Reference in New Issue
Block a user