Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
131f5e3
New translations readme.md (French)
Nonolanlan1007 Jun 25, 2025
487134f
New translations readme.md (French)
Nonolanlan1007 Jun 25, 2025
4dfe634
New translations readme.md (French)
Nonolanlan1007 Jun 25, 2025
603584b
New translations readme.md (French)
Nonolanlan1007 Dec 20, 2025
06f2694
New translations readme.md (French)
Nonolanlan1007 Dec 20, 2025
65fa024
New translations readme.md (French)
Nonolanlan1007 Dec 20, 2025
748c8b6
New translations readme.md (French)
Nonolanlan1007 Dec 20, 2025
5ccdae2
New translations readme.md (French)
Nonolanlan1007 Dec 20, 2025
92c68df
New translations readme.md (French)
Nonolanlan1007 Dec 20, 2025
083edc7
New translations readme.md (French)
Nonolanlan1007 Dec 20, 2025
e3bffce
New translations readme.md (French)
Nonolanlan1007 Dec 20, 2025
edb6dc9
New translations readme.md (French)
Nonolanlan1007 Dec 20, 2025
7d5ff7d
New translations readme.md (French)
Nonolanlan1007 Dec 20, 2025
93d7405
New translations readme.md (French)
Nonolanlan1007 Dec 20, 2025
24649a6
New translations readme.md (French)
Nonolanlan1007 Dec 20, 2025
d2309f1
New translations readme.md (French)
Nonolanlan1007 Dec 20, 2025
9caced9
New translations readme.md (French)
Nonolanlan1007 Dec 20, 2025
32332b0
New translations readme.md (French)
Nonolanlan1007 Dec 20, 2025
86c0d95
Update source file README.md
Nonolanlan1007 Dec 20, 2025
cc4cb10
Update source file README.md
Nonolanlan1007 Dec 20, 2025
41d9f77
Update source file README.md
Nonolanlan1007 Dec 20, 2025
bde6ecc
Update source file README.md
Nonolanlan1007 Dec 20, 2025
d747583
Update source file README.md
Nonolanlan1007 Dec 20, 2025
08455a8
Update source file README.md
Nonolanlan1007 Dec 20, 2025
9428800
Update source file README.md
Nonolanlan1007 Dec 20, 2025
603b813
Update source file README.md
Nonolanlan1007 Dec 20, 2025
f2776db
Update source file README.md
Nonolanlan1007 Dec 20, 2025
e87202f
Update source file README.md
Nonolanlan1007 Dec 20, 2025
5a7d707
Update source file README.md
Nonolanlan1007 Dec 20, 2025
63cad6e
Update source file README.md
Nonolanlan1007 Dec 20, 2025
e0e0b85
Update source file README.md
Nonolanlan1007 Dec 20, 2025
c2cce85
Update source file README.md
Nonolanlan1007 Dec 20, 2025
74268e2
Update source file README.md
Nonolanlan1007 Dec 20, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions en/get-started/advanced-usage/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@ A few articles on how to get the most out of Discord Analytics.
::card [/docs/main/get-started/advanced-usage/esm] Using ESM (Javascript) --- Are you using ESModules in your project? No problem, you'll just need to adapt your code. ::
::card [/docs/main/get-started/advanced-usage/optimize-events] Optimize events (Javascript) --- Save performance by avoiding having to declare the same event twice! ::
::card [/docs/main/get-started/advanced-usage/receive-votes] Receive votes --- Setup a webhook to receive an universal webhook in your app! ::
::card [/docs/main/get-started/advanced-usage/custom-events] Custom Events --- Create the stats that best suit your bot! ::
:::

72 changes: 72 additions & 0 deletions en/get-started/advanced-usage/custom-events/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# Custom Events

Custom Events is a feature of Discord Analytics that allows you to define your own events. Currently, you can only create line charts.

In this example we'll assume your bot uses Discord.js and you want to know how often the `messageReactionAdd` event is triggered.

## Create the custom event

Before we start, we need to create an event on Discord Analytics' dashboard. Log in at https://discordanalytics.xyz/dash, select your bot in the menu, and go to the "Custom Events" page. Then click "Create Custom Event":

![Image](https://r2.discordanalytics.xyz/images/docs/advanced-usage/custom_events/step_1.png)

Now you need to define two things:
- The event key, which is a unique identifier for this event. It cannot be updated later, so don't use too generic a value.
- The Graph Name, which is the name of the graph shown on the dashboard.

![Image](https://r2.discordanalytics.xyz/images/docs/advanced-usage/custom_events/step_2.png)

Then open your bot's code and add the following lines:
```js
const { default: DiscordAnalytics} = require("@discordanalytics/discordjs");
const {
ActionRowBuilder, Client, IntentsBitField, InteractionType, ModalBuilder,
TextInputBuilder, TextInputStyle
} = require("discord.js");
require('dotenv/config');

const client = new Client({
intents: [ // GuildMessageReactions and GuildMessages are required to receive the messageReactionAdd event
IntentsBitField.Flags.Guilds,
IntentsBitField.Flags.GuildMessageReactions,
IntentsBitField.Flags.GuildMessages
],
});

const analytics = new DiscordAnalytics({
client: client,
api_key: process.env.DISCORD_ANALYTICS_API_KEY,
debug: true,
});

client.on('clientReady', async () => {
console.log('Client is ready!');

await analytics.init();
});

client.on('messageReactionAdd', (reaction) => {
analytics.events('reaction_add').increment()
})

client.login(process.env.DISCORD_TOKEN);
```

Restart your bot and open a channel your bot can see. Send a message and add a reaction to it. Wait 10 minutes for the stats to update, then refresh the dashboard page.

The `analytics.events()` function returns an `Event` object which provides the following methods:
```js
const event = analytics.events("my_awesome_event");

event.increment() // Increment the event value by 1
event.increment(2) // Increment the event value by 2

event.decrement() // Decrement the event value by 1 (value cannot be negative)
event.decrement(2) // Decrement the event value by 2

event.set(5) // Set the event value to 5

event.get() // Returns the current event value (e.g. 5)
```

You now know how to use this feature, and Discord Analytics can give you stats about features specific to your bot.
6 changes: 3 additions & 3 deletions en/get-started/advanced-usage/receive-votes/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,13 @@ npm run deploy

Log in to your Cloudflare account, then return to your terminal. Once the deployment is complete, retrieve the URL and open it in your browser to verify that the deployment was successful.

![Image](https://i.imgur.com/rVdqs31.png)
![Image](https://r2.discordanalytics.xyz/images/docs/advanced-usage/receive-votes/terminal_screenshot.png)

### Registering webhook on Discord Analytics

Login to Discord Analytics dashboard, then go to your bot's settings. Scroll to the "Votes Webhook" section

![Image](https://i.imgur.com/aP96t7G.png)
![Image](https://r2.discordanalytics.xyz/images/docs/advanced-usage/receive-votes/webhook_field.png)

Paste your URL in the field and add `/webhook` at the end.

Expand All @@ -80,7 +80,7 @@ This section of the page is designed for advanced users who want to integrate th

### How does it work?

![Image](https://i.imgur.com/2YDKEAI.png)
![Image](https://r2.discordanalytics.xyz/images/docs/advanced-usage/receive-votes/operating_diagram.png)

When a user votes for your bot on a bot list, the bot list sends a POST request to the Discord Analytics webhook. Our API save the vote, if you have set up a webhook, it will send a POST request to your app.

Expand Down
4 changes: 2 additions & 2 deletions en/get-started/advanced-usage/teams/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ For the latest package versions, the team is synchronised with the discord.dev b
- Then, go to your bot's settings
- Paste the ID in the "Stats Access" section.

![Image](https://i.imgur.com/i55JUgL.png)
![Image](https://r2.discordanalytics.xyz/images/docs/advanced-usage/teams/edit_step_1.png)

- After clicking on ‘Add’, you will be asked to choose a way of sending the invitation to your future teammate.

![Image](https://i.imgur.com/AGtiyIu.png)
![Image](https://r2.discordanalytics.xyz/images/docs/advanced-usage/teams/edit_step_2.png)

:::warn
The email option requires the user to have a Discord Analytics account.
Expand Down
8 changes: 4 additions & 4 deletions en/get-started/bot-registration/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@
1. [First, copy your bot's ID.](https://support.discord.com/hc/en-us/articles/206346498-Where-can-I-find-my-User-Server-Message-ID-)
2. Next, go to the dashboard and click on "add bot"

![Image](https://i.imgur.com/tEzxQv5.png)
![Image](https://r2.discordanalytics.xyz/images/docs/get-started/bot_registration/step_1.png)

3. In the popup that appears, paste your bot's ID and accept the Terms of Use, then validate.

![Image](https://i.imgur.com/knW5uCp.png)
![Image](https://r2.discordanalytics.xyz/images/docs/get-started/bot_registration/step_2.png)

4. Once you have added your bot, you are redirected to this page : 

![Image](https://i.imgur.com/QKCS1c8.png)
![Image](https://r2.discordanalytics.xyz/images/docs/get-started/bot_registration/step_3.png)

5. Click on "Go to settings" and copy your bot's token

![Image](https://i.imgur.com/mzoIAP6.png)
![Image](https://r2.discordanalytics.xyz/images/docs/get-started/bot_registration/step_4.png)
10 changes: 5 additions & 5 deletions en/get-started/installation/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ We've provided some code snippets for your information to make it easier for you
:::

:::cards
::card [/docs/main/get-started/installation/discord.js](https://i.imgur.com/WiVzrys.png) Discord.js --- JavaScript/TypeScript ::
::card [/docs/main/get-started/installation/eris](https://i.imgur.com/10WtUMU.png) Eris --- JavaScript/TypeScript ::
::card [/docs/main/get-started/installation/oceanic.js](https://i.imgur.com/LODQ0vh.png) Oceanic.js --- JavaScript/TypeScript ::
::card [/docs/main/get-started/installation/java](https://i.imgur.com/O0XXIbz.png) Java --- Discord4J, Javacord, JDA ::
::card [/docs/main/get-started/installation/discord.py](https://i.imgur.com/pM0NRFB.png) Discord.py --- Python ::
::card [/docs/main/get-started/installation/discord.js](https://r2.discordanalytics.xyz/images/docs/get-started/installation/djs_banner.png) Discord.js --- JavaScript/TypeScript ::
::card [/docs/main/get-started/installation/eris](https://r2.discordanalytics.xyz/images/docs/get-started/installation/eris_banner.png) Eris --- JavaScript/TypeScript ::
::card [/docs/main/get-started/installation/oceanic.js](https://r2.discordanalytics.xyz/images/docs/get-started/installation/oceanic_banner.png) Oceanic.js --- JavaScript/TypeScript ::
::card [/docs/main/get-started/installation/java](https://r2.discordanalytics.xyz/images/docs/get-started/installation/java_banner.png) Java --- Discord4J, Javacord, JDA ::
::card [/docs/main/get-started/installation/discord.py](https://r2.discordanalytics.xyz/images/docs/get-started/installation/discordpy_banner.png) Discord.py --- Python ::
:::
30 changes: 14 additions & 16 deletions en/get-started/installation/discord.js/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,24 @@ The package is compatible with Discord.js v14 or higher

## Dependency

Let's install `discord-analytics`'s package :
Let's install `@discordanalytics/discordjs`'s package :

:::tabs
::tab [NPM]
```shell
npm install discord-analytics
npm install @discordanalytics/discordjs
```
::

::tab [YARN]
```bash
yarn add discord-analytics
yarn add @discordanalytics/discordjs
```
::

::tab [PNPM]
```bash
pnpm install discord-analytics
pnpm install @discordanalytics/discordjs
```
::
:::endtabs
Expand All @@ -36,7 +36,7 @@ pnpm install discord-analytics
// Import Discord.js's client and intents
const { Client, IntentsBitField } = require("discord.js")
// import discord-analytics
const { default: DiscordAnalytics } = require("discord-analytics/discordjs")
const { default: DiscordAnalytics } = require("@discordanalytics/discordjs")

// Create Discord client
const client = new Client({
Expand All @@ -47,15 +47,14 @@ const client = new Client({
// Don't forget to replace YOUR_API_TOKEN by your Discord Analytics token !
const analytics = new DiscordAnalytics({
client: client,
apiToken: 'YOUR_API_TOKEN',
api_key: 'YOUR_API_TOKEN',
sharded: false // Set it to true if your bot use shards
});

// start tracking selected events
analytics.trackEvents();

// When Discord client is ready
client.on('ready', () => {
client.on('clientReady', async () => {
await analytics.init();
analytics.trackEvents();
console.log("Bot is ready!");
});

Expand All @@ -70,7 +69,7 @@ client.login('token');
// Import Discord.js's client and intents
import { Client, IntentsBitField } from "discord.js";
// import discord-analytics
import DiscordAnalytics from "discord-analytics/discordjs";
import DiscordAnalytics from "@discordanalytics/discordjs";

// Create Discord client
const client = new Client({
Expand All @@ -81,15 +80,14 @@ const client = new Client({
// Don't forget to replace YOUR_API_TOKEN by your Discord Analytics token !
const analytics = new DiscordAnalytics({
client: client,
apiToken: 'YOUR_API_TOKEN',
api_key: 'YOUR_API_TOKEN',
sharded: false // Set it to true if your bot use shards
});

// start tracking selected events
analytics.trackEvents();

// When Discord client is ready
client.on('ready', () => {
client.on('clientReady', async () => {
await analytics.init();
analytics.trackEvents();
console.log("Bot is ready!");
});

Expand Down
44 changes: 24 additions & 20 deletions en/get-started/installation/eris/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,24 +14,24 @@ Discord Analytics is not compatible with Eris shards.

## Dependency

Let's install `discord-analytics`'s package :
Let's install `@discordanalytics/eris`'s package :

:::tabs
::tab [NPM]
```sh
npm install discord-analytics
npm install @discordanalytics/eris
```
::

::tab [Yarn]
```bash
yarn add discord-analytics
yarn add @discordanalytics/eris
```
::

::tab [PNPM]
```bash
pnpm install discord-analytics
pnpm install @discordanalytics/eris
```
::
:::endtabs
Expand All @@ -42,19 +42,21 @@ pnpm install discord-analytics
::tab [JavaScript]
```javascript
const {Client} = require("eris");
const {default: DiscordAnalytics} = require("discord-analytics/eris");
const {default: DiscordAnalytics} = require("@discordanalytics/eris");

// Create Eris client.
// Don't forget to replace token by your Discord bot token !
const bot = new Client("token");

bot.on("ready", () => {
// Create Discord Analytics instance
// Don't forget to replace YOUR_API_TOKEN by your Discord Analytics token !
const analytics = new DiscordAnalytics({
client: client,
apiToken: 'YOUR_API_TOKEN'
});
// Create Discord Analytics instance
// Don't forget to replace YOUR_API_TOKEN by your Discord Analytics token !
const analytics = new DiscordAnalytics({
client: bot,
api_key: 'YOUR_API_TOKEN'
});

bot.on("ready", async () => {
await analytics.init();

// start tracking selected events
analytics.trackEvents();
Expand All @@ -70,19 +72,21 @@ bot.connect();
::tab [TypeScript]
```typescript
import {Client} from "eris";
import DiscordAnalytics from "discord-analytics/eris";
import DiscordAnalytics from "@discordanalytics/eris";

// Create Eris client.
// Don't forget to replace token by your Discord bot token !
const bot = new Client("token");

bot.on("ready", () => {
// Create Discord Analytics instance
// Don't forget to replace YOUR_API_TOKEN by your Discord Analytics token !
const analytics = new DiscordAnalytics({
client: client,
apiToken: 'YOUR_API_TOKEN'
});
// Create Discord Analytics instance
// Don't forget to replace YOUR_API_TOKEN by your Discord Analytics token !
const analytics = new DiscordAnalytics({
client: bot,
api_key: 'YOUR_API_TOKEN'
});

bot.on("ready", async () => {
await analytics.init();

// start tracking selected events
analytics.trackEvents();
Expand Down
4 changes: 4 additions & 0 deletions en/get-started/installation/java/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@

The package is compatible with Discord4J version 3.2.6 or higher, Javacord version 3.8.0 or higher, and JDA version 5.0.0-beta.8 or higher.

:::warn
This package is no longer maintained by the Discord Analytics team. Feal free to create a Pull Request at https://github.com/DiscordAnalytics/java-package
:::

## Dependency

Let's install `discord-analytics`'s package (To get the latest version of the package please see this [page](https://github.com/DiscordAnalytics/java-package/releases)) :
Expand Down
Loading