mirror of
https://github.com/RYGhub/royalnet.git
synced 2024-11-23 11:34:18 +00:00
Set typing status on Discord while a command is running
This commit is contained in:
parent
22d1d15f05
commit
96dfedbcf9
1 changed files with 12 additions and 7 deletions
|
@ -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:
|
||||
|
|
Loading…
Reference in a new issue