# Struct EventContext

> What an event handler can do: send, reply, react, delete and send direct messages. Every call is an ordinary command on the bot's member, checked by the host.

`zaun_bot::EventContext` · Struct

```rust
pub struct EventContext { … }
```

What an event handler can do: send, reply, react, delete and send direct messages. Every
call is an ordinary command on the bot's member, checked by the host.

## Fields

### `me: Option<Ready>`

Who and where the bot is, once `on_ready` has run (always, for every later event).

## Methods

### `send`

```rust
pub fn send<impl Into<Reply>>(&self, channel_id: &str, reply: impl Into<Reply>) -> Result<Id, HostError>
```

Sends a message to a channel. Returns its id.

# Errors
The host's refusal.

### `reply_to`

```rust
pub fn reply_to<impl Into<Reply>>(&self, message: &Message, reply: impl Into<Reply>) -> Result<Id, HostError>
```

Replies to a message, in its channel.

# Errors
The host's refusal.

### `react`

```rust
pub fn react(&self, message: &Message, emoji: &str) -> Result<(), HostError>
```

Adds a reaction.

# Errors
The host's refusal.

### `delete_message`

```rust
pub fn delete_message(&self, message: &Message) -> Result<(), HostError>
```

Deletes a message (the bot's own, or any with `MANAGE_MESSAGES`).

# Errors
The host's refusal.

### `dm`

```rust
pub fn dm<impl Into<Reply>>(&self, member_id: &str, reply: impl Into<Reply>) -> Result<(Id, Id), HostError>
```

Sends a direct message to a member (capability `dms`). Returns the DM's channel id and
the message id. `FORBIDDEN` with reason `dms_closed` when the member does not take DMs
from bots or closed this one.

# Errors
The host's refusal.

### `is_me`

```rust
pub fn is_me(&self, member_id: &str) -> bool
```

Whether `member_id` is the bot itself (to ignore its own messages).

### `mentions_me`

```rust
pub fn mentions_me(&self, message: &Message) -> bool
```

Whether `message` mentions the bot: by its member id, by `@everyone`, or by one of its
roles. Only when the message names roles does it ask the host for the bot's own roles
(`community::get_member`); a refusal there counts as not mentioned.

## Trait implementations

`Clone`, `Debug`, `Default`

[Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/events/struct.EventContext.html)
