Properties
Last updated
// set global prop
Bot.setProp({ name: 'myProp', value: 15 });
// set JSON prop for user
User.setProp({
name: 'BIO',
value: { email: "test@example.com", age: 10 }
}); // set global prop
Bot.setProperty("myProp", 15, "float"); // set global prop
Bot.setProp({
name: 'otherUserProp',
value: "test Prop",
// you can pass other user.id for saving user prop for other user
user_id: other_user.id
}); // set global prop
Bot.setProp({
name: 'otherUserProp',
value: "test Prop",
// you can pass other user.id for saving user prop for other user
user_telegramid: other_user.telegramid
});// get global prop
var myProp = Bot.getProp('myProp');
Bot.sendMessage("prop: " + myProp);
// get prop for user
var bio = User.getProp('BIO');
Bot.sendMessage("Hello, " + bio);// prop by default will be 15
var myProp = Bot.getProp('myProp', 15);// get prop for other user
var bio = Bot.getProp({
name: 'BIO',
// you can pass other user.id for getting other user prop
user_id: other_user_id
// or by telegramid:
// user_telegramid: other_user_telegramid
});// get other bot prop for cur user
var bio = Bot.getProp({
name: 'BIO',
bot_id: other_bot_id // available via bot.id
// if needed:
// user_id: userID // for user's prop
// user_telegramid: tgID // for user by telegramid
});// get other bot prop for cur user
var bio = Bot.getProp({
name: 'BIO',
bot_id: other_bot_id // available via bot.id
// you can pass other user.id for getting other user prop
user_id: other_user_id
});// prop "myProp" will be removed
Bot.deleteProp("myProp");// prop "myProp" with null value will be removed
Bot.setProp("myProp", null, "float");