Properties
Introducing
It is possible to save data in bot. Data can be numeric, text, datetime and etc.
For example:
Bot can have DailyBonus saved in bot prop (it is global for all bot)
User can have Balance saved in user prop (it is personall)
Types
Properties can be:
integer, e.g.:
150
float, e.g.:
5.5
boolean:
true, false
string, e.g.:
"Hello world"
text, e.g.:
"it is very big text ..... 1000 symbols here or more"
json, e.g.:
{ any: "data", here: "can", be: {used: true}, with: ["array", "too"] }
datetime, e.g:
new Date()
Set property
so for global prop use
Bot.xxx
methodfor user's prop use
User.xxx
method
also you can use old style:
Set prop for other user by id
Set prop for other user by telegramid
You can set (or read) property via bot_id and read (or set) it via telegramid. It doesn't matter and it will be the same value.
You can save prop in the List
Please read this article
Get property
or get prop with default value:
Getting other user's prop:
You can set (or read) property via bot_id and read (or set) it via telegramid. It doesn't matter and it will be the same value.
Getting other bot prop for current user:
Getting other bot prop for other user:
Delete property
Then null
passing to prop's value is delete property also:
Last updated
Was this helpful?