1
Fork 0
mirror of https://github.com/RYGhub/royalnet.git synced 2024-11-23 19:44:20 +00:00

Set typing status on Discord while a command is running

This commit is contained in:
Steffo 2019-07-09 19:44:26 +03:00
parent 22d1d15f05
commit 96dfedbcf9

View file

@ -115,12 +115,14 @@ class DiscordBot(GenericBot):
author: typing.Union[discord.User] = message.author
if author.bot:
return
# Find and clean parameters
command_text, *parameters = text.split(" ")
# Don't use a case-sensitive command name
command_name = command_text.lower()
# Call the command
await self.call(command_name, message.channel, parameters, message=message)
# Start typing
with message.channel.typing():
# Find and clean parameters
command_text, *parameters = text.split(" ")
# Don't use a case-sensitive command name
command_name = command_text.lower()
# Call the command
await self.call(command_name, message.channel, parameters, message=message)
async def on_ready(cli):
log.debug("Connection successful, client is ready")
@ -146,7 +148,10 @@ class DiscordBot(GenericBot):
def find_channel_by_name(cli,
name: str,
guild: typing.Optional[discord.Guild] = None) -> discord.abc.GuildChannel:
"""Find the :py:class:`TextChannel`, :py:class:`VoiceChannel` or :py:class:`CategoryChannel` with the specified name. Case-insensitive.
"""Find the :py:class:`TextChannel`, :py:class:`VoiceChannel` or :py:class:`CategoryChannel` with the specified name.
Case-insensitive.
Guild is optional, but the method will raise a :py:exc:`TooManyFoundError` if none is specified and there is more than one channel with the same name.
Will also raise a :py:exc:`NoneFoundError` if no channels are found."""
if guild is not None: