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

Types

Link copied to clipboard
class Builder(value: Int = 0)

Properties

Link copied to clipboard
val value: Int

The raw value used by Discord.

Link copied to clipboard

A Set of all AttachmentFlags contained in this instance of AttachmentFlags.

Functions

Link copied to clipboard
operator fun contains(flag: AttachmentFlag): Boolean

Checks if this instance of AttachmentFlags has all bits set that are set in flag.

operator fun contains(flags: AttachmentFlags): Boolean

Checks if this instance of AttachmentFlags has all bits set that are set in flags.

Link copied to clipboard
inline fun copy(builder: AttachmentFlags.Builder.() -> Unit): AttachmentFlags

Returns a copy of this instance of AttachmentFlags modified with builder.

Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard
operator fun minus(flag: AttachmentFlag): AttachmentFlags

Returns an instance of AttachmentFlags that has all bits set that are set in this except the bits that are set in flag.

operator fun minus(flags: AttachmentFlags): AttachmentFlags

Returns an instance of AttachmentFlags that has all bits set that are set in this except the bits that are set in flags.

Link copied to clipboard
operator fun plus(flag: AttachmentFlag): AttachmentFlags

Returns an instance of AttachmentFlags that has all bits set that are set in this and flag.

operator fun plus(flags: AttachmentFlags): AttachmentFlags

Returns an instance of AttachmentFlags that has all bits set that are set in this and flags.

Link copied to clipboard
open override fun toString(): String