-
-
Notifications
You must be signed in to change notification settings - Fork 15
Bot Context
Jey edited this page Aug 15, 2024
·
19 revisions
The bot can also provide the ability to remember some data through the UserData
and ClassData
interfaces.
-
userData
is a user-level data. -
classData
is a class-level data, i.e. the data will be stored until the user moves to a command or input that is in a different class. (in function mode it will work like as user data)
By default, implementation is provided through ConcurrentHashMap
but can be changed to your own through UserData
and ClassData
interfaces using
the data storage tools of your choice.
Caution
Don't forget to hit gradle kspKotlin
/or any relevant ksp task to make required codegen bindings available.
To change, all you need to do is put under your implementation @CtxProvider
annotation and run gradle ksp task (or build).
@CtxProvider
class MyRedis : UserData<String> {
// ...
}
Telegram bot Wiki © KtGram