Telegex.Plug behaviour (Telegex.Plug v0.3.0) View Source

Updates processing plug-in.

Link to this section Summary

Types

The preset category.

State data.

Stateful call result, return type and new state.

The stateless call result directly returns the type.

Functions

Get the preset type of a plug.

Get the username of the bot.

Update the username of the bot.

Link to this section Types

Specs

preset() :: :preheater | :message_handler | :commander | :caller | :custom

The preset category.

Specs

state() :: any()

State data.

Specs

stateful() :: {stateless(), state()}

Stateful call result, return type and new state.

Specs

stateless() :: :ok | :error | :ignored

The stateless call result directly returns the type.

Link to this section Functions

Specs

__preset__(atom()) :: preset()

Get the preset type of a plug.

Specs

get_usename() :: String.t()

Get the username of the bot.

Unless Telegex.Plug.update_username/1 has been called, nil will be returned.

Link to this function

update_username(username)

View Source

Specs

update_username(String.t()) :: :ok

Update the username of the bot.

This function will improve the accuracy of command matching.

Link to this section Callbacks

Specs

__preset__() :: preset()

Specs

call(update :: Telegex.Model.Update.t(), state :: state()) ::
  stateless() | stateful()

Pass update and call.