DefaultCustomBehaviourContextAndTypeReceiver
class DefaultCustomBehaviourContextAndTypeReceiver<BC : BehaviourContext, R, U : Update>(wrapperReceiver: CustomBehaviourContextAndTypeReceiver<BC, R, U>) : SuspendFunction2<BC, U, R>
Behaviour wrapper that injects a lazily-evaluated, cached provider of bot information into the BehaviourContext.
When this wrapper is used, any code executed inside it may call BehaviourContext.botInfo to obtain the current bot's ExtendedBot information. The info is fetched via GetMe only once and then cached for subsequent calls, with concurrent access synchronized by a mutex.
Parameters
BC
Type of BehaviourContext used in the wrapped logic.
R
Result type produced by the wrapped receiver.
U
Type of Update handled by the wrapped receiver.
wrapperReceiver
The original receiver to be invoked after the bot info provider is registered in the context.
Types
Functions
Link copied to clipboard
Registers the internal bot info provider in BehaviourContext.data and then delegates to wrapperReceiver.
Link copied to clipboard
fun <BC : BehaviourContext, R, U : Update> CustomBehaviourContextAndTypeReceiver<BC, R, U>.optionallyWithDefaultReceiver(include: Boolean, data: BehaviourContextData): suspend BC.(U) -> R
Link copied to clipboard
fun <BC : BehaviourContext, R, U : Update> CustomBehaviourContextAndTypeReceiver<BC, R, U>.withDefaultReceiver(data: BehaviourContextData): DefaultCustomBehaviourContextAndTypeReceiver<BC, R, U>