New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Utils] Text to file #2849
[Utils] Text to file #2849
Conversation
Please use |
iirc, discord.File requires the use of BytesIO for in-memory streams. |
discord.File support any file object, I also tested it specifically with |
https://discordpy.readthedocs.io/en/stable/api.html#file The type requires BufferedIOBase. StringIO does not inherit from this base class. |
@retke I had the same problem when I wanted to send a file to the chat long time ago, and this is what was explained to me: https://i.imgur.com/nJnT4Wt.png As for BytesIO/StringIO usage, one of the things I was trying to send in the chat as StringIO simply failed with some weird encoding error, that went away after switching to BytesIO with UTF-8 encoding set, so I'd recommend that. It was quite complicated mess of markdown-rich reddit post generator if this gives you any context to what could've happened. |
Signed-off-by: retke <laggron42@gmail.com>
Oops wrong branch, sorry This reverts commit 14e199e.
Should be ready now. |
Type
Description of the changes
This is a short util that will convert a long string into a
discord.File
object, useful to bypass the character limit. Nothing is wrote on the disk,io.BytesIO
is used instead.Example