I noticed that the on_message event handler can only handle 1 message at a time.
So when we need to process some time_consuming tasks inside it, it will actually block the bot from handling messages come in later.
In the example below, if the user sends two or more messages in a row quickly, the bot will pick up the first message and start processing it, but it won't process the second message until it finishes the first one and sends the result back, in this case, say it will take minutes to execute that get_result_from_time_consuming_task function. It will actually block all incoming messages while doing it.
I was trying to implement multi-thread to process the time consuming task, but after playing around, I couldn't get the message sending to work with it.
@client.event
async def on_message(message):
result = get_result_from_time_consuming_task()
sent_message = await message.channel.send(result)