As the documentation shows, Context implements the send()
method as:
send(content=None, *, tts=False, embed=None, file=None, files=None, delete_after=None, nonce=None, allowed_mentions=None, reference=None, mention_author=None)
Notice the file
parameter. If we look into its description we see that it indeed does what you're looking to do, and it accepts an argument of type File. If you manage your downloaded pdf into Discord.py's File format, you can send it along (or you can put multiple such files in a list and send it with the files
parameter).
Looking into the documentation should always be the first thing you try when you need to learn more about a library.
The minimal way to make a File object is to pass a file pointer (the thing you get from open()
ing a file) or a file name, if you downloaded the pdf already. So you should take the result of requests.get(eodfiles)
and save them to file names you can then use like
file = discord.File("EOD.pdf")
# You only need to customise the `filename` parameter if you want the name to appear different
and then call
await ctx.send(file=file)
The details on how to save a file downloaded through requests
depends on requests
, and you can easily research that on their documentation, or see this question that seems to address the problem.