GuildMemberFlags

A collection of multiple GuildMemberFlags.

Creating an instance of GuildMemberFlags

You can create an instance of GuildMemberFlags using the following methods:

// from individual GuildMemberFlags
val guildMemberFlags1 = GuildMemberFlags(GuildMemberFlag.DidRejoin, GuildMemberFlag.CompletedOnboarding)

// from an Iterable
val iterable: Iterable<GuildMemberFlag> = TODO()
val guildMemberFlags2 = GuildMemberFlags(iterable)

// using a builder
val guildMemberFlags3 = GuildMemberFlags {
+guildMemberFlags2
+GuildMemberFlag.DidRejoin
-GuildMemberFlag.CompletedOnboarding
}

Modifying an existing instance of GuildMemberFlags

You can create a modified copy of an existing instance of GuildMemberFlags using the copy method:

guildMemberFlags.copy {
+GuildMemberFlag.DidRejoin
}

Mathematical operators

All GuildMemberFlags objects can use +/- operators:

val guildMemberFlags1 = guildMemberFlags + GuildMemberFlag.DidRejoin
val guildMemberFlags2 = guildMemberFlags - GuildMemberFlag.CompletedOnboarding
val guildMemberFlags3 = guildMemberFlags1 + guildMemberFlags2

Checking for GuildMemberFlags

You can use the contains operator to check whether an instance of GuildMemberFlags contains specific GuildMemberFlags:

val hasGuildMemberFlag = GuildMemberFlag.DidRejoin in guildMemberFlags
val hasGuildMemberFlags = GuildMemberFlags(GuildMemberFlag.DidRejoin, GuildMemberFlag.CompletedOnboarding) in guildMemberFlags

Unknown GuildMemberFlags

Whenever GuildMemberFlags haven't been added to Kord yet, they will be deserialized as instances of GuildMemberFlag.Unknown.

You can also use GuildMemberFlag.fromShift to check for unknown GuildMemberFlags.

val hasUnknownGuildMemberFlag = GuildMemberFlag.fromShift(23) in guildMemberFlags

See also

Types

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

Properties

Link copied to clipboard
val code: Int

The raw code used by Discord.

Link copied to clipboard

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

Functions

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

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

operator fun contains(flags: GuildMemberFlags): Boolean

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

Link copied to clipboard

Returns a copy of this instance of GuildMemberFlags 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

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

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

Link copied to clipboard

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

operator fun plus(flags: GuildMemberFlags): GuildMemberFlags

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

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