nosedrum v0.1.0 Nosedrum.Invoker behaviour

Invoker modules process messages from Discord.

They determine the following things:

  • whether the message is a valid command
  • whether the author is permitted to issue the command. When both of these conditions are met, the command callback function is invoked.

Link to this section Summary

Callbacks

Called by consumers when a message arrives

Link to this section Callbacks

Link to this callback

handle_message(message, storage)
handle_message(
  message :: Nostrum.Struct.Message.t(),
  storage :: Nostrum.Storage
) :: any()

Called by consumers when a message arrives.

This is the main entry point for invokers: from here on they check whether the message could contain a valid command based on their configured prefix and ask the selected Nosedrum.Storage whether a command exists. If it exists, they proceed to invoke it using only the arguments to the message, with bot prefix and command invocation removed from the message.

The second argument, storage, determines which storage implementation the command invoker should use. A command invoker implementation can supply this argument by default if applicable.