ComponentId class

An identifier for message components containing metadata about the handler associated with the component.

This class contains the data needed for nyxx_commands to find the correct handler for a component interaction event, and throw an error if no handler is found.

Call toString to get the custom id to use on a component. A new ComponentId shhould be used for each component.

ComponentIds should not be stored before use. See expiresAt for the reason why.

Constructors

ComponentId({required int uniqueIdentifier, required DateTime sessionStartTime, required DateTime? expiresAt, required ComponentIdStatus status, required Snowflake? allowedUser})
Create a new ComponentId.
const
ComponentId.generate({Duration? expirationTime, Snowflake? allowedUser})
Generate a new unique ComponentId.
factory

Properties

allowedUser Snowflake?
If the handler associated with this component only allows a specific user to use the component, the ID of that user, otherwise null.
final
expiresAt DateTime?
If the handler associated with this component has an expiration timeout, the time at which it will expire, otherwise null.
final
expiresIn Duration?
The time remaining until the handler for this ComponentId expires, if expiresAt was set.
no setter
hashCode int
The hash code for this object.
no setteroverride
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
sessionStartTime DateTime
The time at which the process that created this ComponentId was started.
final
status ComponentIdStatus
The status of this ComponentId.
final
uniqueIdentifier int
A unique identifier (in this process) for this component.
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
override
withStatus(ComponentIdStatus status) ComponentId
Copy this ComponentId with a new status.

Operators

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

Static Properties

currentSessionStartTime DateTime
The start time of the current session.
final

Static Methods

parse(String id) ComponentId?
Parse a ComponentId received from the API.