ComponentId.generate constructor

ComponentId.generate(
  1. {Duration? expirationTime,
  2. Snowflake? allowedUser}
)

Generate a new unique ComponentId.

expirationTime should be the time after which the handler will expire. allowedUser should be the ID of the user allows to interact with this component.

Implementation

factory ComponentId.generate({Duration? expirationTime, Snowflake? allowedUser}) => ComponentId(
      uniqueIdentifier: _uniqueIdentifier++,
      sessionStartTime: currentSessionStartTime,
      expiresAt: expirationTime != null ? DateTime.now().add(expirationTime).toUtc() : null,
      status: ComponentIdStatus.ok,
      allowedUser: allowedUser,
    );