# Struct prelude::Member

> community objects

`zaun_bot::prelude::Member` · Struct

```rust
pub struct Member { … }
```

---- community objects ------------------------------------------------------------

## Fields

### `member_id: Id`

### `display_name: String`

### `role_ids: Vec<Id>`

### `joined_at: Timestamp`

### `bot_id: Option<Id>`

Present only for bots.

### `voice_channel: Option<Id>`

The voice channel the member is in, if any and if the bot can see that channel.
Always filled for an interaction's invoker, so `/play` can join the caller.

## Methods

### `mention`

```rust
pub fn mention(&self) -> String
```

The text that shows a mention of this member: `<@member_id>`.

### `send`

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

Sends the member a direct message (capability `dms`), opening the DM when needed.
Returns the DM's channel id and the message id.

# Errors
`FORBIDDEN` with detail `dms_closed` when the member does not take DMs from bots.

### `kick`

```rust
pub fn kick(&self, reason: Option<&str>) -> Result<(), HostError>
```

Removes the member from the community (`KICK_MEMBERS`).

# Errors
The host's refusal.

### `timeout`

```rust
pub fn timeout(&self, until: Option<Timestamp>, reason: Option<&str>) -> Result<(), HostError>
```

Times the member out until `until` (ms since the epoch); `None` clears it
(`TIMEOUT_MEMBERS`).

# Errors
The host's refusal.

### `add_role`

```rust
pub fn add_role(&self, role_id: &str) -> Result<(), HostError>
```

Gives the member a role below the bot's own (`MANAGE_ROLES`).

# Errors
The host's refusal.

### `remove_role`

```rust
pub fn remove_role(&self, role_id: &str) -> Result<(), HostError>
```

Takes a role away (`MANAGE_ROLES`).

# Errors
The host's refusal.

### `has_role`

```rust
pub fn has_role(&self, role_id: &str) -> bool
```

Whether the member had `role_id` when the bot saw it.

### `is_bot`

```rust
pub fn is_bot(&self) -> bool
```

Whether the member is a bot.

## Trait implementations

`Clone`, `Debug`

[Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/types/struct.Member.html)
