On this page

MessageDraft object

MessageDraft represents a message that has not been published yet. Message drafts allow you to mention users, reference channels, and add URLs to a message.

Properties

MessageDraft has the following properties:

1public class MessageDraft
2{
3 public string Text { get; }
4 public List<MessageElement> MessageElements { get; }
5 public bool ShouldSearchForSuggestions { get; set; }
6 public List<ChatInputFile> Files { get; set; }
7}
ParameterDescription
Text
Type: string
The current text of the draft.
MessageElements
Type: List<MessageElement>
The current message elements.
ShouldSearchForSuggestions
Type: bool
Whether the MessageDraft should search for suggestions whenever the text is changed.
Files
Type: List<ChatInputFile>
List of files to attach to the message. Refer to Files for more details.

Events

The MessageDraft object has the following events:

1// Event triggered when a message draft is updated
2public event Action<List<MessageElement>, List<SuggestedMention>> OnDraftUpdated;

Example

Insert suggested mentions when updating a message draft.

1

Methods

You can call the following methods on the MessageDraft object.

Click on each method for more details.

Use case

MessageDraft methods enable users to prepare draft messages with:

Last updated on