# Interface: messages

> 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.

Generated from `zaun:bot@0.2.0` (`wit/` in [zaun-bot](https://github.com/zaunchat/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.

## Uses

- `use types.{id, host-error, message, message-body}`

## Functions

### `send`

```wit
send: func(channel-id: id, body: message-body, reply-to: option<id>) -> result<id, host-error>;
```

`message.send`. Returns the new message id.

### `edit`

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

`message.edit` of one of the bot's messages.

### `delete`

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

`message.delete`.

### `react`

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

`reaction.add`.

### `unreact`

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

`reaction.remove` of the bot's own reaction.

### `history`

```wit
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`

```wit
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`

```wit
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.
