Skip to content

Commit

Permalink
Remove ValTracker API for seeing past bundles
Browse files Browse the repository at this point in the history
It was becoming buggy and unmaintained, so he took it down.
  • Loading branch information
giorgi-o committed May 24, 2024
1 parent fea96a8 commit 6c050a0
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 55 deletions.
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,9 @@ For advanced users who want to deploy the bot using [Docker](https://www.docker.

## Acknowledgements

- [Hamper](https://github.com/OwOHamper/) for the idea and [the code](https://github.com/OwOHamper/Valorant-item-shop-discord-bot/blob/main/item_shop_viewer.py) showing how to do it
- [Hamper](https://github.com/OwOHamper/) for the inspiration and [the code](https://github.com/OwOHamper/Valorant-item-shop-discord-bot/blob/main/item_shop_viewer.py) showing how to do it
- [Valorant-api](https://dash.valorant-api.com/) for the skin names and images
- [muckelba](https://github.com/muckelba) for writing the battlepass calculator
- [Spirit](https://github.com/SpiritLetsPlays) for his [API](https://docs.valtracker.gg/bundles) for getting previous bundle items and prices
- [warriorzz](https://github.com/warriorzz) for setting up the Docker
- [The dev discord server](https://discord.gg/a9yzrw3KAm), join here!

Expand Down
2 changes: 1 addition & 1 deletion misc/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export const fetch = (url, options={}) => {
headers: {
cookie: "dummy=cookie", // set dummy cookie, helps with cloudflare 1020
"Accept-Language": "en-US,en;q=0.5", // same as above
"referer": "https://github.com/giorgi-o/SkinPeek", // to help other APIs (e.g. Spirit's) see where the traffic is coming from
"referer": "https://github.com/giorgi-o/SkinPeek", // to help other APIs see where the traffic is coming from
...options.headers
},
ciphers: tlsCiphers.join(':'),
Expand Down
53 changes: 1 addition & 52 deletions valorant/cache.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { client } from "../discord/bot.js";
import { sendShardMessage } from "../misc/shardMessage.js";
import { RIOT_CLIENT_HEADERS } from "./shop.js";

const formatVersion = 13;
const formatVersion = 14;
let gameVersion;

let weapons, skins, rarities, buddies, sprays, cards, titles, bundles, battlepass;
Expand Down Expand Up @@ -213,57 +213,6 @@ const getBundleList = async (gameVersion) => {
}
}

// get bundle items from https://docs.valtracker.gg/bundles
const req2 = await fetch("https://api.valtracker.gg/v1/bundles");
console.assert(req2.statusCode === 200, `ValTracker bundles items status code is ${req.statusCode}!`, req);

const json2 = JSON.parse(req2.body);
console.assert(json.status === 200, `ValTracker bundles items data status code is ${json.status}!`, json);

for (const bundleData of json2.data) {
if (bundles[bundleData.uuid]) {
const bundle = bundles[bundleData.uuid];
const items = [];
const defaultItemData = {
amount: 1,
discount: 0
}

for (const weapon of bundleData.weapons)
items.push({
uuid: weapon.levels[0].uuid,
type: itemTypes.SKIN,
price: weapon.price,
...defaultItemData
});
for (const buddy of bundleData.buddies)
items.push({
uuid: buddy.levels[0].uuid,
type: itemTypes.BUDDY,
price: buddy.price,
...defaultItemData
});
for (const card of bundleData.cards)
items.push({
uuid: card.uuid,
type: itemTypes.CARD,
price: card.price,
...defaultItemData
});
for (const spray of bundleData.sprays)
items.push({
uuid: spray.uuid,
type: itemTypes.SPRAY,
price: spray.price,
...defaultItemData
});

bundle.items = items;
bundle.last_seen = bundleData.last_seen
bundle.price = bundleData.price;
}
}

saveSkinsJSON();
}

Expand Down

0 comments on commit 6c050a0

Please sign in to comment.