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

Copy Markdown

Lays out the calls an agent waits on as one Slack message.

  • Each call shows its tool, the policy's question and its arguments, with a note box and Approve and Deny buttons.
  • A call waiting on a sign-in has Show link instead. It shows only the person who pressed it where to sign in.

Each button's value holds the conversation, the call and who asked, for WardrikSlack.Answers. This is safe because only the bot can change its own messages.

Summary

Functions

Returns what calls ask for, in words.

Returns the block ID of the buttons for the call id.

Returns the blocks for calls, each with its question and buttons.

Returns the message that asks approvers about calls.

Returns approvers joined for a sentence. Member IDs become mentions.

Returns the block ID of the note box for the call id.

Functions

asked(calls)

@spec asked([WardrikChannel.Waiting.t()]) :: String.t()

Returns what calls ask for, in words.

WardrikSlack.Waiting.asked(calls)
#=> "approve `echo` and sign in for `mail`"

buttons_block(id)

@spec buttons_block(String.t()) :: String.t()

Returns the block ID of the buttons for the call id.

calls_blocks(calls)

@spec calls_blocks([WardrikChannel.Waiting.t()]) :: [map()]

Returns the blocks for calls, each with its question and buttons.

message(calls, approvers)

@spec message([WardrikChannel.Waiting.t()], [String.t()] | :anyone) :: %{
  text: String.t(),
  blocks: [map()]
}

Returns the message that asks approvers about calls.

named(approvers)

@spec named([String.t()]) :: String.t()

Returns approvers joined for a sentence. Member IDs become mentions.

WardrikSlack.Waiting.named(["@maria", "@jon", "U024BE7LH"])
#=> "@maria, @jon or <@U024BE7LH>"

note_block(id)

@spec note_block(String.t()) :: String.t()

Returns the block ID of the note box for the call id.