Listen for Property Changes
Subscribed users, bots, and globals broadcast property changes to the plugin.
These can be listened for by binding functions to OnPropertyChanged
:
client.OnPropertyChanged += (Property prop) => {
string value = property.ParseValue<string>().Data;
}
Get All Properties
Get all properties on a user, all properties on a bot, or all global properties.
UserProperty
var result = await client.UserProperty.GetAll("5db0acbc46d06a0089c1f06b");
BotProperty
var result = await client.BotProperty.GetAll("5db0acbc46d06a0089c1f06b");
GlobalProperty
var result = await client.GlobalProperty.GetAll();
Get Property
Get a single property.
UserProperty
var result = await client.UserProperty.Get("5db0acbc46d06a0089c1f06b", "property_name");
if (result.IsSuccess) {
Property property = result.Data;
string value = property.ParseValue<string>().Data;
}
BotProperty
var result = await client.BotProperty.Get("5db0acbc46d06a0089c1f06b", "property_name");
if (result.IsSuccess) {
Property property = result.Data;
string value = property.ParseValue<string>().Data;
}
GlobalProperty
var result = await client.GlobalProperty.Get("property_name");
if (result.IsSuccess) {
Property property = result.Data;
string value = property.ParseValue<string>().Data;
}
Add Property
UserProperty
var result = await client.UserProperty.Add("5db0acbc46d06a0089c1f06b", "property_name", "value");
BotProperty
var result = await client.BotProperty.Add("5db0acbc46d06a0089c1f06b", "property_name", "value");
GlobalProperty
var result = await client.GlobalProperty.Add("property_name", "value");