tanjun.clients#
Standard Tanjun client.
ClientCallbackNames
module-attribute
#
ClientCallbackNames = tanjun.ClientCallbackNames
Alias of tanjun.abc.ClientCallbackNames.
PrefixGetterSig
module-attribute
#
PrefixGetterSig = _PrefixGetterSig[Ellipsis]
Type hint of a callable used to get the prefix(es) for a specific guild.
This represents the callback async def (tanjun.abc.MessageContext, ...) -> collections.Iterable[str]
where dependency injection is supported.
Client #
Tanjun's standard tanjun.abc.Client implementation.
This implementation supports dependency injection for checks, command callbacks, prefix getters and event listeners. For more information on how this works see alluka.
When manually managing the lifetime of the client the linked rest app or bot must always be started before the Tanjun client.
Note
By default this client includes a parser error handling hook which will by overwritten if you call tanjun.Client.set_hooks.
checks
property
#
checks: collections.Collection[tanjun.AnyCheckSig]
Collection of the level tanjun.abc.Context checks registered to this client.
Note
These may be taking advantage of the standard dependency injection.
hooks
property
#
hooks: typing.Optional[tanjun.AnyHooks]
Top level tanjun.abc.AnyHooks set for this client.
These are called during both message, menu and slash command execution.
interaction_accepts
property
#
interaction_accepts: InteractionAcceptsEnum
The types of interactions this client is executing.
is_human_only
property
#
is_human_only: bool
Whether this client is only executing for non-bot/webhook users messages.
menu_hooks
property
#
menu_hooks: typing.Optional[tanjun.MenuHooks]
Top level tanjun.abc.MenuHooks set for this client.
These are only called during menu command execution.
message_accepts
property
#
message_accepts: MessageAcceptsEnum
Type of message create events this command client accepts for execution.
message_hooks
property
#
message_hooks: typing.Optional[tanjun.MessageHooks]
Top level tanjun.abc.MessageHooks set for this client.
These are only called during message command execution.
prefix_getter
property
#
prefix_getter: typing.Optional[PrefixGetterSig]
Prefix getter method set for this client.
For more information on this callback's signature see tanjun.clients.PrefixGetterSig.
prefixes
property
#
prefixes: collections.Collection[str]
Collection of the standard prefixes set for this client.
slash_hooks
property
#
slash_hooks: typing.Optional[tanjun.SlashHooks]
Top level tanjun.abc.SlashHooks set for this client.
These are only called during slash command execution.
__init__ #
__init__(rest, *, cache=None, events=None, server=None, shards=None, voice=None, event_managed=False, injector=None, mention_prefix=False, set_global_commands=False, declare_global_commands=False, command_ids=None, message_ids=None, user_ids=None, _stack_level=0)
Initialise a Tanjun client.
Note
For a quicker way to initiate this client around a standard bot aware client, see tanjun.Client.from_gateway_bot and tanjun.Client.from_rest_bot.
PARAMETER | DESCRIPTION |
---|---|
rest |
The Hikari REST client this will use.
TYPE:
|
cache |
The Hikari cache client this will use if applicable. |
events |
The Hikari event manager client this will use if applicable. This is necessary for message command dispatch and will also
be necessary for interaction command dispatch if
TYPE:
|
server |
The Hikari interaction server client this will use if applicable. This is used for interaction command dispatch if interaction events aren't being received from the event manager.
TYPE:
|
shards |
The Hikari shard aware client this will use if applicable.
TYPE:
|
voice |
The Hikari voice component this will use if applicable.
TYPE:
|
event_managed |
Whether or not this client is managed by the event manager. An event managed client will be automatically started and closed based on Hikari's lifetime events. This can only be passed as True if
TYPE:
|
injector |
The alluka client this should use for dependency injection. If not provided then the client will initialise its own DI client. |
mention_prefix |
Whether or not mention prefixes should be automatically set when this client is first started. It should be noted that this only applies to message commands.
TYPE:
|
declare_global_commands |
Whether or not to automatically set global slash commands when this client is first started. If one or more guild objects/IDs are passed here then the registered global commands will be set on the specified guild(s) at startup rather than globally. The endpoint this uses has a strict ratelimit which, as of writing, only allows for 2 requests per minute (with that ratelimit either being per-guild if targeting a specific guild otherwise globally).
TYPE:
|
set_global_commands |
Deprecated as of v2.1.1a1 alias of
TYPE:
|
command_ids |
If provided, a mapping of top level command names to IDs of the existing commands to update. This will be used for all application commands but in cases where
commands have overlapping names, This field is complementary to This currently isn't supported when multiple guild IDs are passed for
TYPE:
|
message_ids |
If provided, a mapping of message context menu command names to the IDs of existing commands to update.
TYPE:
|
user_ids |
If provided, a mapping of user context menu command names to the IDs of existing commands to update.
TYPE:
|
RAISES | DESCRIPTION |
---|---|
ValueError
|
Raises for the following reasons:
|
add_check #
add_check(*checks)
Add a generic check to this client.
This will be applied to both message and slash command execution.
PARAMETER | DESCRIPTION |
---|---|
*checks |
The checks to add. These may be either synchronous or asynchronous and must take one positional argument of type tanjun.abc.Context with dependency injection being supported for its keyword arguments.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Self
|
The client instance to enable chained calls. |
add_component #
add_component(component)
Add a component to this client.
PARAMETER | DESCRIPTION |
---|---|
component |
The component to move to this client. |
RETURNS | DESCRIPTION |
---|---|
Self
|
The client instance to allow chained calls. |
RAISES | DESCRIPTION |
---|---|
ValueError
|
If the component's name is already registered. |
add_prefix #
add_prefix(prefixes)
Add a prefix used to filter message command calls.
This will be matched against the first character(s) in a message's content to determine whether the message command search stage of execution should be initiated.
PARAMETER | DESCRIPTION |
---|---|
prefixes |
Either a single string or an iterable of strings to be used as prefixes. |
RETURNS | DESCRIPTION |
---|---|
Self
|
The client instance to enable chained calls. |
close
async
#
close(*, deregister_listeners=True)
Close the client.
RAISES | DESCRIPTION |
---|---|
RuntimeError
|
If the client isn't running. |
fetch_rest_application_id
async
#
fetch_rest_application_id()
Fetch the ID of the application this client is linked to.
RETURNS | DESCRIPTION |
---|---|
hikari.Snowflake
|
The application ID of the application this client is linked to. |
from_gateway_bot
classmethod
#
from_gateway_bot(bot, /, *, event_managed=True, injector=None, mention_prefix=False, declare_global_commands=False, set_global_commands=False, command_ids=None, message_ids=None, user_ids=None)
Build a tanjun.Client from a gateway bot.
Note
This defaults the client to human only mode and sets type
dependency injectors for the hikari traits present in bot
.
PARAMETER | DESCRIPTION |
---|---|
bot |
The bot client to build from. This will be used to infer the relevant Hikari clients to use.
TYPE:
|
event_managed |
Whether or not this client is managed by the event manager. An event managed client will be automatically started and closed based on Hikari's lifetime events.
TYPE:
|
injector |
The alluka client this should use for dependency injection. If not provided then the client will initialise its own DI client. |
mention_prefix |
Whether or not mention prefixes should be automatically set when this client is first started. It should be noted that this only applies to message commands.
TYPE:
|
declare_global_commands |
Whether or not to automatically set global slash commands when this client is first started. If one or more guild objects/IDs are passed here then the registered global commands will be set on the specified guild(s) at startup rather than globally. The endpoint this uses has a strict ratelimit which, as of writing, only allows for 2 requests per minute (with that ratelimit either being per-guild if targeting a specific guild otherwise globally).
TYPE:
|
set_global_commands |
Deprecated as of v2.1.1a1 alias of
TYPE:
|
command_ids |
If provided, a mapping of top level command names to IDs of the commands to update. This field is complementary to This currently isn't supported when multiple guild IDs are passed for
TYPE:
|
message_ids |
If provided, a mapping of message context menu command names to the IDs of existing commands to update.
TYPE:
|
user_ids |
If provided, a mapping of user context menu command names to the IDs of existing commands to update.
TYPE:
|
from_rest_bot
classmethod
#
from_rest_bot(bot, /, *, bot_managed=False, declare_global_commands=False, injector=None, set_global_commands=False, command_ids=None, message_ids=None, user_ids=None)
Build a tanjun.Client from a hikari.traits.RESTBotAware instance.
Note
This sets type dependency injectors for the hikari traits present in
bot
(including hikari.traits.RESTBotAware).
PARAMETER | DESCRIPTION |
---|---|
bot |
The bot client to build from.
TYPE:
|
declare_global_commands |
Whether or not to automatically set global slash commands when this client is first started. If one or more guild objects/IDs are passed here then the registered global commands will be set on the specified guild(s) at startup rather than globally. The endpoint this uses has a strict ratelimit which, as of writing, only allows for 2 requests per minute (with that ratelimit either being per-guild if targeting a specific guild otherwise globally).
TYPE:
|
bot_managed |
Whether the client should be managed by the REST bot. A REST bot managed client will be automatically started and closed based on the REST bot's startup and shutdown callbacks.
TYPE:
|
injector |
The alluka client this should use for dependency injection. If not provided then the client will initialise its own DI client. |
set_global_commands |
Deprecated as of v2.1.1a1 alias of
TYPE:
|
command_ids |
If provided, a mapping of top level command names to IDs of the existing commands to update. This will be used for all application commands but in cases where
commands have overlapping names, This field is complementary to This currently isn't supported when multiple guild IDs are passed for
TYPE:
|
message_ids |
If provided, a mapping of message context menu command names to the IDs of existing commands to update.
TYPE:
|
user_ids |
If provided, a mapping of user context menu command names to the IDs of existing commands to update.
TYPE:
|
on_autocomplete_interaction_request
async
#
on_autocomplete_interaction_request(interaction)
on_command_interaction_request
async
#
on_command_interaction_request(interaction)
Execute an app command based on received REST requests.
PARAMETER | DESCRIPTION |
---|---|
interaction |
The interaction to execute a command based on.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
hikari.api.InteractionMessageBuilder | hikari.api.InteractionDeferredBuilder | hikari.api.InteractionModalBuilder
|
The initial response to send back to Discord. |
on_gateway_autocomplete_create
async
#
on_gateway_autocomplete_create(interaction)
Execute command autocomplete based on a received gateway interaction create.
PARAMETER | DESCRIPTION |
---|---|
interaction |
The interaction to execute a command based on.
TYPE:
|
on_gateway_command_create
async
#
on_gateway_command_create(interaction)
Execute an app command based on a received gateway interaction create.
PARAMETER | DESCRIPTION |
---|---|
interaction |
The interaction to execute a command based on.
TYPE:
|
on_interaction_create_event
async
#
on_interaction_create_event(event)
Handle a gateway interaction create event.
This will execute both application command and autocomplete interactions.
PARAMETER | DESCRIPTION |
---|---|
event |
The event to execute commands based on.
TYPE:
|
on_message_create_event
async
#
on_message_create_event(event)
Execute a message command based on a gateway event.
PARAMETER | DESCRIPTION |
---|---|
event |
The event to handle.
TYPE:
|
open
async
#
open(*, register_listeners=True)
Start the client.
If mention_prefix
was passed to tanjun.Client.__init__
or tanjun.Client.from_gateway_bot then this function may make a fetch request
to Discord if it cannot get the current user from the cache.
RAISES | DESCRIPTION |
---|---|
RuntimeError
|
If the client is already active. |
remove_check #
remove_check(check)
Remove a check from the client.
PARAMETER | DESCRIPTION |
---|---|
check |
The check to remove.
TYPE:
|
RAISES | DESCRIPTION |
---|---|
ValueError
|
If the check was not previously added. |
remove_prefix #
remove_prefix(prefix)
Remove a message content prefix from the client.
PARAMETER | DESCRIPTION |
---|---|
prefix |
The prefix to remove.
TYPE:
|
RAISES | DESCRIPTION |
---|---|
ValueError
|
If the prefix is not registered with the client. |
RETURNS | DESCRIPTION |
---|---|
Self
|
The client instance to enable chained calls. |
set_auto_defer_after #
set_auto_defer_after(time)
Set when this client should automatically defer execution of commands.
Warning
If time
is set to None then automatic deferrals will be disabled.
This may lead to unexpected behaviour.
PARAMETER | DESCRIPTION |
---|---|
time |
The time in seconds to defer interaction command responses after. |
set_autocomplete_ctx_maker #
set_autocomplete_ctx_maker(maker=context.AutocompleteContext)
Set the autocomplete context maker to use when creating contexts.
Warning
The caller must return an instance of tanjun.context.AutocompleteContext rather than just any implementation of the AutocompleteContext abc due to this client relying on implementation detail of tanjun.context.AutocompleteContext.
PARAMETER | DESCRIPTION |
---|---|
maker |
The autocomplete context maker to use. This is a callback which should match the signature of tanjun.context.AutocompleteContext.init and return an instance of tanjun.context.AutocompleteContext.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Self
|
This client to enable method chaining. |
set_case_sensitive #
set_case_sensitive(state)
Set whether this client defaults to being case sensitive for message commands.
PARAMETER | DESCRIPTION |
---|---|
state |
Whether this client's message commands should be matched case-sensitively. This may be overridden by component specific configuration.
TYPE:
|
set_default_app_command_permissions #
set_default_app_command_permissions(permissions)
Set the default member permissions needed for this client's commands.
Warning
This may be overridden by guild staff and does not apply to admins.
PARAMETER | DESCRIPTION |
---|---|
permissions |
The default member permissions needed for this client's application commands. This may be overridden by tanjun.abc.AppCommand.default_member_permissions and tanjun.abc.Component.default_app_cmd_permissions; if this is left as None then this config will be inherited from the parent client. |
RETURNS | DESCRIPTION |
---|---|
Self
|
This client to enable method chaining. |
set_dms_enabled_for_app_cmds #
set_dms_enabled_for_app_cmds(state)
Set whether this clients's commands should be enabled in DMs.
PARAMETER | DESCRIPTION |
---|---|
state |
Whether to enable this client's commands in DMs. This may be overridden by tanjun.abc.AppCommand.is_dm_enabled and tanjun.abc.Component.dms_enabled_for_app_cmds; if this is left as None then this config will be inherited from the parent client.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Self
|
This client to enable method chaining. |
set_ephemeral_default #
set_ephemeral_default(state)
Set whether slash contexts spawned by this client should default to ephemeral responses.
This defaults to False if not explicitly set.
PARAMETER | DESCRIPTION |
---|---|
state |
Whether slash command contexts executed in this client should should default to ephemeral. This will be overridden by any response calls which specify flags.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Self
|
This client to enable method chaining. |
set_global_commands
async
#
set_global_commands(*, application=None, guild=hikari.UNDEFINED, force=False)
Alias of [tanjun.Client.declare_global_commands][].
deprecated
Since v2.1.1a1; use [tanjun.Client.declare_global_commands][] instead.
set_hikari_trait_injectors #
set_hikari_trait_injectors(bot)
Set type based dependency injection based on the hikari traits found in bot
.
This is a short hand for calling [tanjun.Client.add_type_dependency][] for all
the hikari trait types bot
is valid for with bot.
PARAMETER | DESCRIPTION |
---|---|
bot |
The hikari client to set dependency injectors for. |
set_hooks #
set_hooks(hooks)
Set the general command execution hooks for this client.
The callbacks within this hook will be added to every slash and message command execution started by this client.
PARAMETER | DESCRIPTION |
---|---|
hooks |
The general command execution hooks to set for this client. Passing None will remove all hooks. |
RETURNS | DESCRIPTION |
---|---|
Self
|
The client instance to enable chained calls. |
set_human_only #
set_human_only(value=True)
Set whether or not message commands execution should be limited to "human" users.
Note
This doesn't apply to interaction commands as these can only be triggered by a "human" (normal user account).
PARAMETER | DESCRIPTION |
---|---|
value |
Whether or not message commands execution should be limited to "human" users. Passing True here will prevent message commands from being executed based on webhook and bot messages.
TYPE:
|
set_interaction_accepts #
set_interaction_accepts(accepts)
Set the kind of interactions this client should execute.
PARAMETER | DESCRIPTION |
---|---|
accepts |
Bitfield of the interaction types this client should execute.
TYPE:
|
RAISES | DESCRIPTION |
---|---|
RuntimeError
|
If called while the client is running. |
set_interaction_not_found #
set_interaction_not_found(message)
Set the response message for when an interaction command is not found.
Warning
Setting this to None may lead to unexpected behaviour (especially when the client is still set to auto-defer interactions) and should only be done if you know what you're doing.
PARAMETER | DESCRIPTION |
---|---|
message |
The message to respond with when an interaction command isn't found. |
set_menu_ctx_maker #
set_menu_ctx_maker(maker=context.MenuContext)
Set the autocomplete context maker to use when creating contexts.
Warning
The caller must return an instance of tanjun.context.MenuContext rather than just any implementation of the MenuContext abc due to this client relying on implementation detail of tanjun.context.MenuContext.
PARAMETER | DESCRIPTION |
---|---|
maker |
The autocomplete context maker to use. This is a callback which should match the signature of tanjun.context.MenuContext.init and return an instance of tanjun.context.MenuContext.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Self
|
This client to enable method chaining. |
set_menu_hooks #
set_menu_hooks(hooks)
Set the menu command execution hooks for this client.
The callbacks within this hook will be added to every menu command execution started by this client.
PARAMETER | DESCRIPTION |
---|---|
hooks |
The menu context specific command execution hooks to set for this client. Passing None will remove the hooks. |
RETURNS | DESCRIPTION |
---|---|
Self
|
The client instance to enable chained calls. |
set_menu_not_found #
set_menu_not_found(message)
Set the response message for when a menu command is not found.
Warning
Setting this to None may lead to unexpected behaviour (especially when the client is still set to auto-defer interactions) and should only be done if you know what you're doing.
PARAMETER | DESCRIPTION |
---|---|
message |
The message to respond with when a menu command isn't found. |
set_message_accepts #
set_message_accepts(accepts)
Set the kind of messages commands should be executed based on.
PARAMETER | DESCRIPTION |
---|---|
accepts |
The type of messages commands should be executed based on.
TYPE:
|
RAISES | DESCRIPTION |
---|---|
RuntimeError
|
If called while the client is running. |
ValueError
|
If |
set_message_ctx_maker #
set_message_ctx_maker(maker=context.MessageContext)
Set the message context maker to use when creating context for a message.
Warning
The caller must return an instance of tanjun.context.MessageContext rather than just any implementation of the MessageContext abc due to this client relying on implementation detail of tanjun.context.MessageContext.
PARAMETER | DESCRIPTION |
---|---|
maker |
The message context maker to use. This is a callback which should match the signature of tanjun.context.MessageContext.__init__ and return an instance of tanjun.context.MessageContext.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Self
|
This client to enable method chaining. |
set_message_hooks #
set_message_hooks(hooks)
Set the message command execution hooks for this client.
The callbacks within this hook will be added to every message command execution started by this client.
PARAMETER | DESCRIPTION |
---|---|
hooks |
The message context specific command execution hooks to set for this client. Passing None will remove all hooks.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Self
|
The client instance to enable chained calls. |
set_prefix_getter #
set_prefix_getter(getter)
Set the callback used to retrieve message prefixes set for the relevant guild.
PARAMETER | DESCRIPTION |
---|---|
getter |
The callback which'll be used to retrieve prefixes for the guild a message context is from. If None is passed here then the callback will be unset. This should be an async callback which one argument of type tanjun.abc.MessageContext and returns an iterable of string prefixes. Dependency injection is supported for this callback's keyword arguments.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Self
|
The client instance to enable chained calls. |
set_slash_ctx_maker #
set_slash_ctx_maker(maker=context.SlashContext)
Set the slash context maker to use when creating context for a slash command.
Warning
The caller must return an instance of tanjun.context.SlashContext rather than just any implementation of the SlashContext abc due to this client relying on implementation detail of tanjun.context.SlashContext.
PARAMETER | DESCRIPTION |
---|---|
maker |
The slash context maker to use. This is a callback which should match the signature of tanjun.context.SlashContext.__init__ and return an instance of tanjun.context.SlashContext.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Self
|
This client to enable method chaining. |
set_slash_hooks #
set_slash_hooks(hooks)
Set the slash command execution hooks for this client.
The callbacks within this hook will be added to every slash command execution started by this client.
PARAMETER | DESCRIPTION |
---|---|
hooks |
The slash context specific command execution hooks to set for this client. Passing None will remove the hooks.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Self
|
The client instance to enable chained calls. |
set_slash_not_found #
set_slash_not_found(message)
Set the response message for when a slash command is not found.
Warning
Setting this to None may lead to unexpected behaviour (especially when the client is still set to auto-defer interactions) and should only be done if you know what you're doing.
PARAMETER | DESCRIPTION |
---|---|
message |
The message to respond with when a slash command isn't found. |
with_check #
with_check(check)
Add a check to this client through a decorator call.
PARAMETER | DESCRIPTION |
---|---|
check |
The check to add. This may be either synchronous or asynchronous and must take one positional argument of type tanjun.abc.Context with dependency injection being supported for its keyword arguments. |
RETURNS | DESCRIPTION |
---|---|
tanjun.abc.CheckSig
|
The added check. |
with_prefix_getter #
with_prefix_getter(getter)
Set the prefix getter callback for this client through decorator call.
Examples:
client = tanjun.Client.from_rest_bot(bot)
@client.with_prefix_getter
async def prefix_getter(ctx: tanjun.abc.MessageContext) -> collections.abc.Iterable[str]:
raise NotImplementedError
PARAMETER | DESCRIPTION |
---|---|
getter |
The callback which'll be to retrieve prefixes for the guild a message event is from. This should be an async callback which one argument of type tanjun.abc.MessageContext and returns an iterable of string prefixes. Dependency injection is supported for this callback's keyword arguments.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
PrefixGetterSig
|
The registered callback. |
InteractionAcceptsEnum #
The possible configurations for which interaction this client should execute.
MessageAcceptsEnum #
The possible configurations for which events tanjun.Client should execute commands based on.
ALL
class-attribute
#
ALL = 'ALL'
Set the client to execute commands based on both DM and guild message create events.
DM_ONLY
class-attribute
#
DM_ONLY = 'DM_ONLY'
Set the client to execute commands based only DM message create events.
GUILD_ONLY
class-attribute
#
GUILD_ONLY = 'GUILD_ONLY'
Set the client to execute commands based only guild message create events.
NONE
class-attribute
#
NONE = 'NONE'
Set the client to not execute commands based on message create events.
get_event_type #
get_event_type()
as_loader #
as_loader(callback=None, /, *, standard_impl=True)
Mark a callback as being used to load Tanjun components from a module.
Note
This is only necessary if you wish to use [tanjun.Client.load_modules][].
PARAMETER | DESCRIPTION |
---|---|
callback |
The callback used to load Tanjun components from a module. This should take one argument of type tanjun.Client (or
tanjun.abc.Client if
TYPE:
|
standard_impl |
Whether this loader should only allow instances of tanjun.Client as opposed to tanjun.abc.Client.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
collections.abc.Callable[[tanjun.abc.Client], None]]
|
The decorated load callback. |
as_unloader #
as_unloader(callback=None, /, *, standard_impl=True)
Mark a callback as being used to unload a module's utilities from a client.
Note
This is the inverse of tanjun.as_loader and is only necessary if you wish to use the [tanjun.Client.unload_modules][] or [tanjun.Client.reload_modules][].
PARAMETER | DESCRIPTION |
---|---|
callback |
The callback used to unload Tanjun components from a module. This should take one argument of type tanjun.Client (or
tanjun.abc.Client if
TYPE:
|
standard_impl |
Whether this unloader should only allow instances of tanjun.Client as opposed to tanjun.abc.Client.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
collections.abc.Callable[[tanjun.abc.Client], None]]
|
The decorated unload callback. |
on_parser_error
async
#
on_parser_error(ctx, error)
Handle message parser errors.
This is the default message parser error hook included by tanjun.Client.