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,6 +115,8 @@ class DiscordBot(GenericBot):
author: typing.Union[discord.User] = message.author author: typing.Union[discord.User] = message.author
if author.bot: if author.bot:
return return
# Start typing
with message.channel.typing():
# Find and clean parameters # Find and clean parameters
command_text, *parameters = text.split(" ") command_text, *parameters = text.split(" ")
# Don't use a case-sensitive command name # Don't use a case-sensitive command name
@ -146,7 +148,10 @@ class DiscordBot(GenericBot):
def find_channel_by_name(cli, def find_channel_by_name(cli,
name: str, name: str,
guild: typing.Optional[discord.Guild] = None) -> discord.abc.GuildChannel: 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. 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.""" Will also raise a :py:exc:`NoneFoundError` if no channels are found."""
if guild is not None: if guild is not None: