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:
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
|
author: typing.Union[discord.User] = message.author
|
||||||
if author.bot:
|
if author.bot:
|
||||||
return
|
return
|
||||||
# Find and clean parameters
|
# Start typing
|
||||||
command_text, *parameters = text.split(" ")
|
with message.channel.typing():
|
||||||
# Don't use a case-sensitive command name
|
# Find and clean parameters
|
||||||
command_name = command_text.lower()
|
command_text, *parameters = text.split(" ")
|
||||||
# Call the command
|
# Don't use a case-sensitive command name
|
||||||
await self.call(command_name, message.channel, parameters, message=message)
|
command_name = command_text.lower()
|
||||||
|
# Call the command
|
||||||
|
await self.call(command_name, message.channel, parameters, message=message)
|
||||||
|
|
||||||
async def on_ready(cli):
|
async def on_ready(cli):
|
||||||
log.debug("Connection successful, client is ready")
|
log.debug("Connection successful, client is ready")
|
||||||
|
@ -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:
|
||||||
|
|
Loading…
Reference in a new issue