# Struct MessageOptions

> A message to post: text, embeds, files and the message it answers. A plain `&str` is one with text only, so `channel.send("hi")` still reads as it did.

`zaun_client::MessageOptions` · Struct

```rust
pub struct MessageOptions { … }
```

A message to post: text, embeds, files and the message it answers. A plain `&str` is one
with text only, so `channel.send("hi")` still reads as it did.

```rust
use zaun_client::{EmbedBuilder, MessageOptions, Picture};

channel.send(
    MessageOptions::new()
        .content("Today's weather")
        .embed(EmbedBuilder::new().title("Sunny").image(Picture::file("map.png")))
        .file("forecast.pdf"),
)?;
```

## Methods

### `mention_member`

```rust
pub fn mention_member(self, member: MemberId) -> Self
```

Notifies `member` (write `mention::member` in the text to show where). Each member
counts once; at most 50.

### `mention_role`

```rust
pub fn mention_role(self, role: RoleId) -> Self
```

Notifies the members with `role` (`mention::role` shows it). The host drops a role
that is not mentionable unless this member has `MENTION_EVERYONE`. At most 20.

### `mention_everyone`

```rust
pub fn mention_everyone(self) -> Self
```

Notifies everyone who can see the channel (needs `MENTION_EVERYONE`; dropped without).

### `mentions`

```rust
pub fn mentions(self, mentions: Mentions) -> Self
```

Notifies exactly `mentions`.

### `mentions_from_content`

```rust
pub fn mentions_from_content(self) -> Self
```

Also notifies whoever the text shows (`<@id>`, `<@&id>`, `@everyone`; see
`mention::parse`). Call it after `content`, and only for text
this member wrote.

### `new`

```rust
pub fn new() -> Self
```

An empty message; it needs text, an embed or a file.

### `content`

```rust
pub fn content<impl Into<String>>(self, content: impl Into<String>) -> Self
```

The text (up to 4 000 characters; may be empty beside an embed or a file).

### `embed`

```rust
pub fn embed<impl Into<EmbedBuilder>>(self, embed: impl Into<EmbedBuilder>) -> Self
```

Adds an embed (up to 10). Its pictures are uploaded with the message's files.

### `embeds`

```rust
pub fn embeds<impl Into<EmbedBuilder>, impl IntoIterator<Item = impl Into<EmbedBuilder>>>(self, embeds: impl IntoIterator<Item = impl Into<EmbedBuilder>>) -> Self
```

Adds embeds.

### `file`

```rust
pub fn file<impl Into<PathBuf>>(self, path: impl Into<PathBuf>) -> Self
```

Attaches the file at `path` (with the embeds' pictures, up to 10 files in all). A file
that is also an embed's picture is uploaded once.

### `file_bytes`

```rust
pub fn file_bytes<impl Into<String>, impl Into<Vec<u8>>>(self, name: impl Into<String>, data: impl Into<Vec<u8>>) -> Self
```

Attaches `data` as a file named `name`.

### `reply_to`

```rust
pub const fn reply_to(self, message: MessageId) -> Self
```

Posts it as an answer to `message`.

## Trait implementations

`Clone`, `Debug`, `Default`, `Eq`, `From<&String>`, `From<&str>`, `From<EmbedBuilder>`, `From<String>`, `PartialEq`, `StructuralPartialEq`

[Full rustdoc page](/docs/api/rust/zaun-client/zaun_client/compose/options/struct.MessageOptions.html)
