MessageFlags
A collection of multiple MessageFlags.
Creating an instance of MessageFlags
You can create an instance of MessageFlags using the following methods:
// from individual MessageFlags
val messageFlags1 = MessageFlags(MessageFlag.CrossPosted, MessageFlag.IsCrossPost)
// from an Iterable
val iterable: Iterable<MessageFlag> = TODO()
val messageFlags2 = MessageFlags(iterable)
// using a builder
val messageFlags3 = MessageFlags {
+messageFlags2
+MessageFlag.CrossPosted
-MessageFlag.IsCrossPost
}
Modifying an existing instance of MessageFlags
You can create a modified copy of an existing instance of MessageFlags using the copy method:
messageFlags.copy {
+MessageFlag.CrossPosted
}
Mathematical operators
All MessageFlags objects can use +
/-
operators:
val messageFlags1 = messageFlags + MessageFlag.CrossPosted
val messageFlags2 = messageFlags - MessageFlag.IsCrossPost
val messageFlags3 = messageFlags1 + messageFlags2
Checking for MessageFlags
You can use the contains operator to check whether an instance of MessageFlags contains specific MessageFlags:
val hasMessageFlag = MessageFlag.CrossPosted in messageFlags
val hasMessageFlags = MessageFlags(MessageFlag.CrossPosted, MessageFlag.IsCrossPost) in messageFlags
Unknown MessageFlags
Whenever MessageFlags haven't been added to Kord yet, they will be deserialized as instances of MessageFlag.Unknown.
You can also use MessageFlag.fromShift to check for unknown MessageFlags.
val hasUnknownMessageFlag = MessageFlag.fromShift(23) in messageFlags
See also
Properties
Functions
Checks if this instance of MessageFlags has all bits set that are set in flag.
Checks if this instance of MessageFlags has all bits set that are set in flags.
Returns a copy of this instance of MessageFlags modified with builder.
Returns an instance of MessageFlags that has all bits set that are set in this
except the bits that are set in flag.
Returns an instance of MessageFlags that has all bits set that are set in this
except the bits that are set in flags.
Returns an instance of MessageFlags that has all bits set that are set in this
and flag.
Returns an instance of MessageFlags that has all bits set that are set in this
and flags.