LemonGateway.CommandRegistry (lemon_gateway v0.1.0)

View Source

Registry of slash command modules.

Maintains a mapping of command names to their implementing modules. Commands are invoked when users send /command_name messages through any transport channel.

Summary

Functions

Returns all registered commands as {name, module} tuples.

Returns a specification to start this module under a supervisor.

Returns the command module for the given name, or nil if not registered.

Returns the command module for the given name, or raises if not found.

Returns a list of all registered command names.

Types

command_mod()

@type command_mod() :: module()

command_name()

@type command_name() :: String.t()

Functions

all_commands()

@spec all_commands() :: [{command_name(), command_mod()}]

Returns all registered commands as {name, module} tuples.

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

get_command(name)

@spec get_command(command_name()) :: command_mod() | nil

Returns the command module for the given name, or nil if not registered.

get_command!(name)

@spec get_command!(command_name()) :: command_mod()

Returns the command module for the given name, or raises if not found.

list_commands()

@spec list_commands() :: [command_name()]

Returns a list of all registered command names.

start_link(opts)