🧊
Resource
Resource are like Storage but with some extra features. It can store, add or subtract values of chat or user. You can create a resource for a chat or user.
Method to return the resource value.
Use this method to update a resource value, you can pass value in the first argument.
This method will add amount to the resource.
This method will deduct amount from the resource
Use this method when you want to remove a resource.
Here is an example showing how to return a resource value of a user:
// Return user's balance;
const balanceRes = Resource.user("balance");
const balance = await balanceRes.value();
Bot.reply(`Balance: ${balance || 0}`);
Here is an example showing how to use resource value of a chat:
// Return chat's balance;
const balanceRes = Resource.chat("balance");
const balance = await balanceRes.value();
Bot.reply(`Balance: ${balance || 0}`);
In private message, chat is same as user.
Last modified 9mo ago