# 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.

**.value()**

Method to return the resource value.

**.set(value)**

Use this method to update a resource value, you can pass value in the first argument.

**.add(amount)**

This method will add amount to the resource.

**.subtract(amount)**

This method will deduct amount from the resource

**.delete()**

Use this method when you want to remove a resource.

**Example**

Here is an example showing how to return a resource value of a user:

```javascript
// 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:

```javascript
// Return chat's balance;
const balanceRes = Resource.chat("balance");
const balance = await balanceRes.value();
Bot.reply(`Balance: ${balance || 0}`);
```

{% hint style="info" %}
In private message, chat is same as user.
{% endhint %}
