AttachmentFlags
A collection of multiple AttachmentFlags.
Creating an instance of AttachmentFlags
You can create an instance of AttachmentFlags using the following methods:
// from individual AttachmentFlags
val attachmentFlags1 = AttachmentFlags(AttachmentFlag.IsRemix, AttachmentFlag.fromShift(22))
// from an Iterable
val iterable: Iterable<AttachmentFlag> = TODO()
val attachmentFlags2 = AttachmentFlags(iterable)
// using a builder
val attachmentFlags3 = AttachmentFlags {
+attachmentFlags2
+AttachmentFlag.IsRemix
-AttachmentFlag.fromShift(22)
}
Modifying an existing instance of AttachmentFlags
You can create a modified copy of an existing instance of AttachmentFlags using the copy method:
attachmentFlags.copy {
+AttachmentFlag.IsRemix
}
Mathematical operators
All AttachmentFlags objects can use +
/-
operators:
val attachmentFlags1 = attachmentFlags + AttachmentFlag.IsRemix
val attachmentFlags2 = attachmentFlags - AttachmentFlag.fromShift(22)
val attachmentFlags3 = attachmentFlags1 + attachmentFlags2
Checking for AttachmentFlags
You can use the contains operator to check whether an instance of AttachmentFlags contains specific AttachmentFlags:
val hasAttachmentFlag = AttachmentFlag.IsRemix in attachmentFlags
val hasAttachmentFlags = AttachmentFlags(AttachmentFlag.IsRemix, AttachmentFlag.fromShift(22)) in attachmentFlags
Unknown AttachmentFlags
Whenever AttachmentFlags haven't been added to Kord yet, they will be deserialized as instances of AttachmentFlag.Unknown.
You can also use AttachmentFlag.fromShift to check for unknown AttachmentFlags.
val hasUnknownAttachmentFlag = AttachmentFlag.fromShift(23) in attachmentFlags
See also
Properties
A Set of all AttachmentFlags contained in this instance of AttachmentFlags.
Functions
Checks if this instance of AttachmentFlags has all bits set that are set in flag.
Checks if this instance of AttachmentFlags has all bits set that are set in flags.
Returns a copy of this instance of AttachmentFlags modified with builder.
Returns an instance of AttachmentFlags that has all bits set that are set in this
except the bits that are set in flag.
Returns an instance of AttachmentFlags that has all bits set that are set in this
except the bits that are set in flags.
Returns an instance of AttachmentFlags that has all bits set that are set in this
and flag.
Returns an instance of AttachmentFlags that has all bits set that are set in this
and flags.