How do I get the inventory of a steam account while comparing options?

Viewed 84

I am trying to make a steam bot and trying to program it like Kalizar bot: https://steamcommunity.com/id/KalizarLevelUpBot/

Now when you chat with the kalizar bot and type the !stats command, the bot replies how many hydra keys, tf2 keys, CS:GO keys, etc. he has in its inventory.

I have been trying to program the similar thing, just for the csgo keys, the main part what I've got so far:

const steaminventory = require("get-steam-inventory");
const ownsteamid = "<mybot'ssteamidcomeshere>";

        let rawData = data.raw.descriptions;
        let tradables = 0;
        let nonTradables = 0;
        rawData.forEach((key) => {
          if (key.tradable == 1) {
            tradables++;
          } else {
            nonTradables++;
          }

          client.chatMessage(
            steamID,
            "I have " + tradables + " tradable CSGO keys and " + nonTradables + " non-tradable ones."
          );
        });

and It works! but the only problem is that it gives the output only 26 times even though there are around 90 keys that match the description like,

`I have 0 tradable CSGO keys and 1 non-tradable ones.

I have 0 tradable CSGO keys and 2 non-tradable ones.

I have 0 tradable CSGO keys and 3 non-tradable ones.

I have 0 tradable CSGO keys and 4 non-tradable ones.

I have 0 tradable CSGO keys and 5 non-tradable ones.

...`

I want to output it as many times as the number of keys matches the condition

OR AN ALTERNATIVE count the number of keys and display them like "I have n number of tradable CS:GO keys" exactly like how the kalizar bot does it.

Any help would be appreciated, thanks.

0 Answers
Related