I'm new to the field of discord bots, I had an idea and it's that, I want to make my bot show "bot is typing..." status before the bot send any messages. I simply want it to looks like real typing you know? And I guess that will look better than just sending the messages immediately.
BTW, I'm using Discord.py Rewrite
Thanks for your help in advance!
example for what I want the bot to do.
Use async with channel.typing()
If you are unfamiliar with the with
statement, it is a way of wrapping a codeblock in a statement, which does something at the start of the code block and the end of the codeblock.
Example:
import asyncio
async def on_message(message):
if message.startswith('ping'):
async with message.channel.typing():
await asyncio.sleep(1)
await message.channel.send('pong')
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With