
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
A TypeScript library for interacting with Top.gg API and websocket-topgg services. Ariwa provides a simple and efficient way to receive real-time vote events, check vote status, and manage bot statistics on Top.gg.
npm install ariwa
import { AriwaClient } from 'ariwa';
const client = new AriwaClient({
ws: 'your-websockets-topgg-token',
topgg: 'your-topgg-api-token', // Optional, for Top.gg API access
name: 'my-awesome-bot',
persistPath: './timestamp.json' // Optional, for persisting last event timestamp
});
// Connect to the WebSocket server
client.connect();
// Listen for vote events
client.on('vote', (voteData) => {
console.log(`User ${voteData.user} voted for bot ${voteData.bot}!`);
// Reward your users here
});
// Listen for other events
client.on('ready', (data) => {
console.log('Connected to Top.gg WebSocket!');
});
client.on('test', (testData) => {
console.log('Received test event:', testData);
});
client.on('reminder', (reminderData) => {
console.log('Received reminder event:', reminderData);
});
// Handle disconnections
client.on('disconnected', (code, reason) => {
console.log(`Disconnected: ${code} - ${reason}`);
});
// Handle errors
client.on('error', (err) => {
console.error('WebSocket error:', err);
});
// Gracefully disconnect
process.on('SIGINT', async () => {
console.log('Disconnecting...');
await client.disconnect();
process.exit(0);
});
// Using the API through the client
const botResult = await client.topgg.getBot('botId');
if (botResult.isOk()) {
const bot = botResult.unwrap();
console.log(`Bot ${bot.username} has ${bot.server_count} servers!`);
}
// Post stats to Top.gg
await client.topgg.postStats('botId', {
server_count: 1500,
shard_count: 10
});
// Check if a user voted
const hasVotedResult = await client.topgg.hasVoted('botId', 'userId');
if (hasVotedResult.isOk() && hasVotedResult.unwrap()) {
console.log('User has voted!');
}
import { AriwaAPI } from 'ariwa';
const api = new AriwaAPI({ token: 'your-websockets-topgg-token' });
// Get entity information
const entityResult = await api.getEntity();
if (entityResult.isOk()) {
console.log('Connected entity:', entityResult.unwrap());
}
// Get user information
const userResult = await api.getUser('userId');
if (userResult.isOk()) {
console.log('User data:', userResult.unwrap());
}
// Set user reminders
await api.setUserReminders('userId', true);
| Option | Type | Description | Default |
|---|---|---|---|
ws | string | WebSockets-TopGG token | Required |
topgg | string | Top.gg API token | undefined |
name | string | Client name for WebSocket connection | Required |
cache | number | Cache TTL in milliseconds | 300000 (5 minutes) |
autoReconnect | boolean | Auto reconnect on disconnect | true |
reconnectOptions | object | Reconnection configuration | See below |
persistPath | string | Path to save timestamp information | undefined |
| Option | Type | Description | Default |
|---|---|---|---|
initialDelay | number | Initial reconnection delay in ms | 1000 |
maxDelay | number | Maximum reconnection delay in ms | 30000 |
maxAttempts | number | Maximum number of reconnection attempts | Infinity |
The AriwaClient emits the following events:
| Event | Description | Data |
|---|---|---|
ready | Connection established | Connection details |
vote | User voted for a bot | Vote details (user, bot, etc.) |
test | Test event received | Test data |
reminder | Vote reminder event | Reminder details |
disconnected | WebSocket disconnected | code and reason |
error | Error occurred | Error object |
unknownOp | Unknown operation received | op and data |
Ariwa uses the @sapphire/result package for error handling. All API methods return a Result object that can be safely unwrapped:
const result = await client.topgg.getBot('botId');
if (result.isOk()) {
// Success
const data = result.unwrap();
console.log(data);
} else {
// Error
const error = result.unwrapErr();
console.error('Failed to get bot:', error);
}
MIT
Contributions are welcome! Please feel free to submit a Pull Request.
FAQs
A unified Discord bot client supporting Top.gg and WebSocket APIs
The npm package ariwa receives a total of 1 weekly downloads. As such, ariwa popularity was classified as not popular.
We found that ariwa demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.