Skip to content

Interface: messages

Generated from zaun:bot@0.2.0 (wit/ in zaun-bot). Do not edit.

Messages and reactions. Every call is an ordinary command on the bot’s member, checked by the host’s permission engine exactly as for any member.

  • use types.{id, host-error, message, message-body}
send: func(channel-id: id, body: message-body, reply-to: option<id>) -> result<id, host-error>;

message.send. Returns the new message id.

edit: func(channel-id: id, message-id: id, body: message-body) -> result<_, host-error>;

message.edit of one of the bot’s messages.

delete: func(channel-id: id, message-id: id) -> result<_, host-error>;

message.delete.

react: func(channel-id: id, message-id: id, emoji: string) -> result<_, host-error>;

reaction.add.

unreact: func(channel-id: id, message-id: id, emoji: string) -> result<_, host-error>;

reaction.remove of the bot’s own reaction.

history: func(channel-id: id, before: option<u64>, limit: u32) -> result<list<message>, host-error>;

message.history: up to limit (1-100) messages before before.

upload: func(channel-id: id, name: string, mime: string, bytes: list<u8>) -> result<id, host-error>;

Uploads a file for the bot’s next message (capability attachments). Returns the attachment id to put in message-body.attachments.

dm: func(member-id: id, body: message-body) -> result<tuple<id, id>, host-error>;

A direct message to member member-id (capability dms): opens the DM when needed, then sends. Returns the DM’s channel id and the message id.