WardrikSlack.Messages (wardrik_slack v0.1.0-rc.1)

Copy Markdown

Passes messages posted in Slack channels to WardrikChannel.received/2, and reacts to them.

  • A message the agent takes gets :eyes:, then :white_check_mark: once it's answered.
  • A message the agent couldn't take gets a reply in its thread saying why.

Ignores edits, deletions, messages from bots (the app included), direct messages, and messages from people in another workspace.

Summary

Functions

Swaps :eyes: for :white_check_mark: on the answered messages ids.

Passes a message event to the room's agent. bot is the app's own member ID.

Returns the member user, with the name Slack shows for them.

Removes :eyes: from the messages ids, when a run stops before answering.

Functions

answered(workspace, room, ids)

@spec answered(WardrikChannel.Workspace.t(), String.t(), [String.t()]) :: :ok

Swaps :eyes: for :white_check_mark: on the answered messages ids.

event(workspace, event, bot)

@spec event(WardrikChannel.Workspace.t(), map(), String.t()) ::
  {:asked, String.t()} | :ignored | {:error, String.t()}

Passes a message event to the room's agent. bot is the app's own member ID.

Returns {:asked, conversation}, :ignored, or {:error, message} after replying with it.

sender(workspace, user)

Returns the member user, with the name Slack shows for them.

stopped(workspace, room, ids)

@spec stopped(WardrikChannel.Workspace.t(), String.t(), [String.t()]) :: :ok

Removes :eyes: from the messages ids, when a run stops before answering.