scarletcafe / jishaku

A debugging and testing cog for discord.py rewrite bots.
https://jishaku.readthedocs.io/en/latest/
MIT License
541 stars 181 forks source link

Add support for a list of files or embeds #125

Closed clari7744 closed 2 years ago

clari7744 commented 3 years ago

Rationale

Allows easy sending of multiple embeds in one message without using ctx.send, same way as single embed works. Same thing with files.

Summary of changes made

I added a check to see if result is an Iterable and if it's all Embeds or Files, and if so it sends all of those. However, it checks for discord.py 2+ for multiple embeds.

Checklist

scarletcafe commented 3 years ago

I don't really like this because this both causes eager iteration of returned iterables, and could cause jishaku to block the event loop if the iterable takes time to traverse, or never ends.

scarletcafe commented 2 years ago

I've decided that this is probably best not to do, considering the possible side effects. I recommend either yielding the File/Embeds as you go or using ctx.send directly if you want to bundle them into the same message.