valorant-info
Version:
A Node.js wrapper for Valorant game data with random agent/weapon picker, team generator, smart caching, and multi-language support.
97 lines (68 loc) โข 2.27 kB
Markdown
# valorant-info ๐ฎ
VALORANT agent & weapon information API wrapper for Node.js โ with random picks, team generators, and caching.
## ๐ What's New in v2.0.0
- **`getRandomAgent()`** โ Get a random VALORANT agent
- **`getRandomWeapon()`** โ Get a random weapon
- **`getRandomTeam()`** โ Generate a random 5-agent team composition
- **In-memory caching** โ 5-minute TTL for faster repeated lookups
- **`clearCache()`** โ Manual cache control
- **Input validation** โ Better error messages
- **URL encoding** โ Proper handling of special characters in names
## ๐ฆ Installation
```bash
npm install valorant-info
```
## ๐ Usage
### Get Agent Info
```js
const { getAgent } = require("valorant-info");
const agent = await getAgent("Jett");
console.log(agent.name); // "Jett"
console.log(agent.role); // "Duelist"
console.log(agent.abilities); // Agent abilities
```
### Get Weapon Info
```js
const { getWeapon } = require("valorant-info");
const weapon = await getWeapon("Vandal");
console.log(weapon.name); // "Vandal"
console.log(weapon.cost); // Weapon cost
console.log(weapon.stats); // Weapon statistics
```
### Random Agent
```js
const { getRandomAgent } = require("valorant-info");
const agent = await getRandomAgent();
console.log(`Play as: ${agent.name} (${agent.role})`);
```
### Random Weapon
```js
const { getRandomWeapon } = require("valorant-info");
const weapon = await getRandomWeapon();
console.log(`Use: ${weapon.name}`);
```
### Random Team Composition
```js
const { getRandomTeam } = require("valorant-info");
const team = await getRandomTeam();
// Returns 5 random agents for a team
team.forEach(agent => {
console.log(` ${agent.name} - ${agent.role}`);
});
```
### Cache Control
```js
const { clearCache } = require("valorant-info");
clearCache(); // Clear all cached data
```
## ๐ก API
| Function | Description |
|----------|-------------|
| `getAgent(name)` | Get agent details by name |
| `getWeapon(name)` | Get weapon details by name |
| `getRandomAgent()` | Get a random agent |
| `getRandomWeapon()` | Get a random weapon |
| `getRandomTeam()` | Generate a random 5-agent team |
| `clearCache()` | Clear the in-memory cache |
## ๐ License
MIT ยฉ Utku Berkay Koรง