Discord Elixir v1.1.4 DiscordEx.Client.Helpers.MessageHelper

Bot Message Helpers

Summary

Functions

Actionable Mention and DM Message

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

Functions

actionable_message_for?(bot_name, payload, state)

Specs

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
msg_command_parse(payload)

Specs

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!"}