Reputation: 545
For now, I have sent files via link (image below), but for security reasons I can't anymore.
A first idea that came to me is to send one file at a time in different messages, but I don't like it.
So, there is a way to send multiple files in a Discord embed (Or multiple files in a single message)?
Upvotes: 0
Views: 2879
Reputation: 1516
This can be accomplished by making a list of discord.File
objects, then passing it as Messageable.send(files=your_list_of_files)
.
I've included code below which opens a list of file objects based on their filenames.
files_to_read: list[str] = []
files_to_send: list[discord.File] = []
for filename in files_to_read:
with open(filename, 'rb') as f: # discord file objects must be opened in binary and read mode
files_to_send.append(discord.File(f))
await {Messageable}.send(files=files_to_send)
Upvotes: 1