[PYTHON] Output large log with discord.py

In discord, one message is 2KB If you want to see the operation log on the bot, you may not be able to send it as a message.

Therefore, it is convenient to have it uploaded to the bot as a text file.

@client.event
async def on_message(message):

   if message.content = 'log':
       log = ''

       #Assemble the log properly
       for d in data:
           log += d + '\n'

       with StringIO(log) as bs:
           await message.channel.send(file=discord.File(bs, 'log.txt'))

Recommended Posts

Output large log with discord.py
Unit test log output with python
Output Python log to console with GAE
Python log is not output with docker-compose up
Output PDF with Django
Markdown output with Django
Make Yubaba with Discord.py
Output PDF with WeasyPrint
I made a window for Log output with Tkinter
Output log to console with Flask + Nginx on Docker
Output log in JSON format with Python standard logging
Output debug log with GAE dev_appserver.py on Eclipse + PyDev
Test standard output with Pytest
Output to syslog with Loguru
[Stock price analysis] Learning pandas with fictitious data (002: Log output)
Make it possible to output a log to a file with go echo
Output log file with Job (Notebook) of Cloud Pak for Data
[python3] Implement debug log output function easily with logging and Click
Make apache log csv with python
Input / output with Python (Python learning memo ⑤)
Output the call graph with PyCallGraph
[Note] Hello world output with python
Try to output audio with M5STACK
Output networkX graph with graphviz (PyGraphviz)