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)
Properties can be belong for user or for bot.
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
You can use short naming also: Bot.setProp
, User.setProp
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:
You can use short naming also: Bot.getProp
, User.getProp
Getting other user's prop:
Your bot must have this user
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:
Your account must have this bot
Getting other bot prop for other user:
Your account must have this bot with this user
Delete property
Then null
passing to prop's value is delete property also:
Last updated