MessageBuilder class

Allows to create pre built custom messages which can be passed to classes which inherits from ISend.

Constructors

MessageBuilder()
Generic constructor for MessageBuilder
MessageBuilder.content(String content)
Creates MessageBuilder with only content
factory
MessageBuilder.embed(EmbedBuilder embed)
Creates MessageBuilder with only embed
factory
MessageBuilder.empty()
Creates MessageBuilder with content of empty character
factory
MessageBuilder.files(List<AttachmentBuilder> files)
Creates MessageBuilder with only specified files
factory
MessageBuilder.fromMessage(IMessage message)
Creates MessageBuilder from Message. Copies content, tts and first embed of target message
factory

Properties

allowedMentions AllowedMentions?
AllowedMentions object to control mentions in message
getter/setter pair
attachments List<AttachmentMetadataBuilder>?
getter/setter pair
content String
Returns current content of message
getter/setter pair
embeds List<EmbedBuilder>?
Embed to include in message
getter/setter pair
files List<AttachmentBuilder>?
List of files to send with message
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
nonce String?
A nonce that can be used for optimistic message sending (up to 25 characters) You will be able to identify that message when receiving it through gateway
getter/setter pair
replyBuilder ReplyBuilder?
Allows to create message that replies to another message
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
tts bool?
Set to true if message should be TTS
getter/setter pair

Methods

addAttachment(AttachmentBuilder attachment) → void
Add attachment
addBytesAttachment(List<int> bytes, String name, {bool spoiler = false}) → void
Add attachment from specified bytes
addEmbed(FutureOr<void> builder(EmbedBuilder embed)) FutureOr<void>
Allows to add embed to message. Warning: Completes future synchronously!
addFileAttachment(File file, {String? name, bool spoiler = false}) → void
Add attachment from specified file
addPathAttachment(String path, {String? name, bool spoiler = false}) → void
Add attachment at specified path
append(Object text) → void
Allows to append
appendBold(Object text) → void
Appends bold text to message
appendClearCharacter() → void
Appends clear character. Can be used to skip first line in message body.
appendCode(Object language, Object code) → void
Appends code block to message
appendCodeSimple(Object text) → void
Appends simple code to message
appendItalics(Object text) → void
Appends italic text to message
appendMention(Mentionable mentionable) → void
Appends Mentionable object to message
appendNewLine() → void
Appends empty line to message
appendSpoiler(Object text) → void
Appends spoiler to message
appendStrike(Object text) → void
Appends strikeout text to message
appendTimestamp(DateTime dateTime, {TimeStampStyle style = TimeStampStyle.def}) → void
Appends timestamp to message from dateTime
appendWithDecoration(Object text, MessageDecoration decoration) → void
Appends formatted text to message
build([AllowedMentions? defaultAllowedMentions]) RawApiMap
canBeUsedAsNewMessage() bool
Returns if this instance of message builder can be used when editing message
getMappedFiles() Iterable<MultipartFile>
hasFiles() bool
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
send(ISend entity) Future<IMessage>
Sends message
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Constants

clearCharacter → const String
Clear character which can be used to skip first line in message body or sanitize message content