npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

discordplace-sync

v1.8.10

Published

SDK officiel pour synchroniser automatiquement les statistiques de votre bot Discord avec DiscordPlace

Readme

@discordplace/sync

Easy AutoPosting to DiscordPlace via the official SDK

⚠️ IMPORTANT - Prérequis pour soumettre votre bot

Votre bot DOIT être en cours d'exécution avec le SDK actif pour pouvoir être soumis !

  1. ✅ Installez le SDK : npm install discordplace-sync
  2. ✅ Générez une clé API sur DiscordPlace
  3. ✅ Intégrez le SDK dans votre code (voir guide ci-dessous)
  4. DÉMARREZ votre bot et LAISSEZ-LE TOURNER
  5. ✅ Attendez que la première synchronisation soit effectuée (environ 5-10 secondes)
  6. PENDANT QUE LE BOT TOURNE, soumettez-le sur DiscordPlace

⚠️ Si vous arrêtez votre bot avant de le soumettre, la soumission sera refusée !

Le système vérifie que votre bot a synchronisé dans les 10 dernières minutes pour s'assurer qu'il est bien actif avec le SDK.


✨ Nouveautés v1.8.9

🔒 Validation stricte avant soumission

  • Le bot doit être actuellement en cours d'exécution avec le SDK
  • Dernière synchronisation requise dans les 10 dernières minutes
  • Empêche la soumission de bots sans SDK actif

✨ Nouveautés v1.8.4

🔇 Mode silencieux par défaut

Les logs du SDK sont maintenant désactivés par défaut pour ne pas polluer votre console. Pour activer les logs de debug, ajoutez l'option debug: true :

const sdk = new DiscordPlaceSDK({
  apiKey: 'votre-clé-api',
  botId: 'votre-bot-id',
  debug: true // Active les logs de debug
});

✨ Nouveautés v1.2.2

🎯 Synchronisation complète des commandes avec options

Le SDK synchronise maintenant toutes les informations de vos commandes :

  • Nom et description de chaque commande
  • Options/paramètres avec leurs types (STRING, INTEGER, USER, etc.)
  • Paramètres obligatoires vs optionnels
  • Choix prédéfinis pour les paramètres
  • Limites (min/max pour les nombres et longueurs de texte)
// Exemple de commande synchronisée :
// /ban <user> [reason] [duration]
// - user: USER (obligatoire) - Utilisateur à bannir
// - reason: STRING (optionnel) - Raison du bannissement
// - duration: INTEGER (optionnel) - Durée en minutes

📊 Affichage amélioré sur DiscordPlace

Les commandes apparaissent maintenant avec tous leurs détails dans :

  • Le panel de modération (pour validation des bots)
  • Les pages publiques des bots
  • La liste des bots avec aperçu des commandes

How to

It's really really simple! All you gotta do is:

const { SyncClient } = require('@discordplace/sync')

const sync = new SyncClient('discordplace-api-key', client) // your discord.js client

// optional
sync.on('synced', (stats) => { // ran when successfully synced
  console.log(`Bot stats synced to DiscordPlace! | ${stats.guildCount} servers`)
})

You can also do sync.on('error', (err) => { ... }) and this will stop errors from being logged and left for you to handle

And that's it!

It will begin to sync your server count, and shard count every 30 minutes.

This even works on individual Discord.JS shards that are process separated.

Traditional Discord.JS Sharding:

If you use Discord.JS' traditional ShardingManager sharder, you can also append the SyncClient to the sharding manager like so:

const sharder = new Discord.ShardingManager(...)

const sync = new SyncClient('discordplace-api-key', sharder)

sharder.spawn() // rest of your stuff!

This will run broadcastEval's and automatically fetch your statistics!

Manual Usage

If you prefer manual control:

const { DiscordPlaceSDK } = require('@discordplace/sync')

const sdk = new DiscordPlaceSDK({
  apiKey: 'your-api-key',
  botId: 'your-bot-id'
})

// Start automatic sync
sdk.start()

// Sync bot info with commands details
await sdk.syncBotInfo(client)

// Or send stats manually
await sdk.postStats({
  guildCount: client.guilds.cache.size,
  userCount: totalUsers,
  latency: client.ws.ping,
  isOnline: true // Control online status explicitly
})

🚀 Synchronisation automatique des commandes

Le SDK détecte automatiquement vos commandes Discord.js et synchronise :

// Vos commandes dans Discord.js
const commands = [
  {
    name: 'ban',
    description: 'Bannit un utilisateur du serveur',
    options: [
      {
        name: 'user',
        description: 'Utilisateur à bannir',
        type: ApplicationCommandOptionType.User,
        required: true
      },
      {
        name: 'reason',
        description: 'Raison du bannissement',
        type: ApplicationCommandOptionType.String,
        required: false,
        maxLength: 500
      }
    ]
  }
]

// Le SDK synchronise automatiquement ces détails avec DiscordPlace !
await sdk.syncBotInfo(client)

Getting Your API Key

  1. Go to DiscordPlace
  2. Navigate to your bot's page
  3. Click on the "SDK" tab
  4. Generate your API key
  5. Copy and use it in your code

Options

const sync = new SyncClient('api-key', client, {
  interval: 30 * 60 * 1000, // 30 minutes (default)
  endpoint: 'https://discordplace.com/api' // API endpoint (default)
})

Events

  • synced - Fired when stats are successfully synced
  • error - Fired when an error occurs
  • ready - Fired when the sync client is ready

Statistics Collected

The SyncClient automatically collects:

  • Server count (guildCount) - Nombre de serveurs
  • User count (userCount) - Nombre total d'utilisateurs
  • Latency (ping) - Latence du bot
  • Commands (commands) - NOUVEAU ! Liste détaillée des commandes avec options
  • Command count (commandCount) - Nombre total de commandes
  • Shard count (if using sharding) - Nombre de shards
  • Online status (isOnline) - Statut en ligne du bot

🆕 Détails des commandes synchronisées

Pour chaque commande, le SDK synchronise :

  • Nom et description
  • Type (slash_command, user_command, message_command)
  • Options/paramètres avec :
    • Nom et description
    • Type (STRING, INTEGER, BOOLEAN, USER, CHANNEL, ROLE, etc.)
    • Si obligatoire ou optionnel
    • Choix prédéfinis (pour les paramètres à choix multiples)
    • Limites min/max (pour les nombres et textes)

License

MIT

const client = new Client({ intents: [GatewayIntentBits.Guilds] });

const sdk = new DiscordPlaceSDK({ apiKey: process.env.DISCORDPLACE_API_KEY, botId: client.user.id, autoSync: true });

client.once('ready', () => { console.log(Bot connecté en tant que ${client.user.tag});

// Démarrer la synchronisation automatique sdk.start(); });

client.login(process.env.BOT_TOKEN);


## Options de configuration

| Option | Type | Description | Défaut |
|--------|------|-------------|--------|
| `apiKey` | string | Clé API DiscordPlace (obligatoire) | - |
| `botId` | string | ID de votre bot Discord (obligatoire) | - |
| `autoSync` | boolean | Synchronisation automatique | `false` |
| `syncInterval` | number | Intervalle de sync en ms | `300000` (5 min) |
| `endpoint` | string | URL de l'API DiscordPlace | `https://api.discordplace.com` |
| `timeout` | number | Timeout des requêtes en ms | `10000` |
| `retries` | number | Nombre de tentatives en cas d'erreur | `3` |

## Gestion des erreurs

```javascript
sdk.on('error', (error) => {
  console.error('Erreur SDK DiscordPlace:', error);
});

sdk.on('success', (data) => {
  console.log('Stats synchronisées avec succès:', data);
});

sdk.on('offline', () => {
  console.log('Bot marqué comme hors ligne sur DiscordPlace');
});

Nouvelles fonctionnalités (v1.2.0)

🎯 Synchronisation des commandes avec descriptions

La lib synchronise maintenant automatiquement les commandes de votre bot avec leurs descriptions complètes :

// Les commandes sont maintenant envoyées avec leurs descriptions
await sdk.syncBotInfo(client);

// Résultat dans DiscordPlace :
// /help - Affiche l'aide du bot
// /music play - Joue une musique
// /admin ban - Bannit un utilisateur

📊 Comptage automatique des commandes

Le nombre total de commandes (commandCount) est automatiquement calculé et synchronisé.

🔄 Synchronisation améliorée

  • Les descriptions des commandes sont récupérées depuis Discord
  • Support des commandes slash et des commandes classiques
  • Synchronisation automatique lors de l'utilisation du SDK

Méthodes

updateStats(stats)

Envoie les statistiques manuellement.

start()

Démarre la synchronisation automatique.

stop()

Arrête la synchronisation automatique.

getStats(period)

Récupère les statistiques historiques.

Obtenir une clé API

  1. Connectez-vous sur DiscordPlace
  2. Allez dans la section "Mes Bots"
  3. Sélectionnez votre bot
  4. Cliquez sur "Générer clé API"
  5. Copiez la clé et gardez-la secrète

Support