Discord Elixir v1.1.18 DiscordEx.Client.Helpers.MessageHelper View Source

Bot Message Helpers

Link to this section Summary

Functions

Actionable Mention and DM Message

Actionable Mention and DM Message This checks that an incoming message is private or is a mention to the current user.

Parameters

  • payload: Data from the triggered event.
  • state: Current state of bot.

Example

MessageHelper.actionable_message_for_me?(payload, state)
#=> true

Parses a message payload which is content leading with ‘!’. Returns a tuple with the command and the message

Parses a message payload which is content leading with provided prefix. Returns a tuple with the command and the message

Link to this section Functions

Link to this function actionable_message_for?(bot_name, payload, state) View Source
actionable_message_for?(String.t(), map(), map()) :: boolean()

Actionable Mention and DM Message

This checks that an incoming message is private or is a mention to the defined user.

Parameters

  • bot_name: Name of the bot you are using.
  • payload: Data from the triggered event.
  • state: Current state of bot.

Example

MessageHelper.actionable_message_for?("Mr.Botman", payload, state)
#=> true
Link to this function actionable_message_for_me?(payload, state) View Source
actionable_message_for_me?(map(), map()) :: boolean()

Actionable Mention and DM Message This checks that an incoming message is private or is a mention to the current user.

Parameters

  • payload: Data from the triggered event.
  • state: Current state of bot.

Example

MessageHelper.actionable_message_for_me?(payload, state)
#=> true
Link to this function msg_command_parse(payload) View Source
msg_command_parse(map()) :: {String.t(), String.t()}

Parses a message payload which is content leading with ‘!’. Returns a tuple with the command and the message.

Parameters

  • payload: Data from the triggered event.

Example

MessageHelper.msg_command_parse(payload)
#=> {"ping", "me please!"}
Link to this function msg_command_parse(payload, prefix) View Source
msg_command_parse(map(), String) :: {String.t(), String.t()}

Parses a message payload which is content leading with provided prefix. Returns a tuple with the command and the message.

Parameters

  • prefix: prefix for your command
  • payload: Data from the triggered event.

Example

MessageHelper.msg_command_parse(payload, "!")
#=> {"ping", "me please!"}