@discordanalytics/discordjs 2.6.2 → 2.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +9 -2
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -74,10 +74,18 @@ class DiscordAnalytics extends core_1.AnalyticsBase {
|
|
|
74
74
|
const userCount = this._sharded
|
|
75
75
|
? ((await this._client.shard?.broadcastEval((c) => c.guilds.cache.reduce((a, g) => a + (g.memberCount || 0), 0)))?.reduce((a, b) => a + b, 0) || 0)
|
|
76
76
|
: this._client.guilds.cache.reduce((a, g) => a + (g.memberCount || 0), 0);
|
|
77
|
+
const userInstallCount = this._sharded
|
|
78
|
+
? ((await this._client.shard?.broadcastEval((c) => c.approximateUserInstallCount))?.reduce((a, b) => a + b, 0) || 0)
|
|
79
|
+
: this._client.approximateUserInstallCount;
|
|
77
80
|
const guildMembers = !this._sharded
|
|
78
81
|
? this._client.guilds.cache.map((guild) => guild.memberCount)
|
|
79
82
|
: ((await this._client.shard?.broadcastEval((c) => c.guilds.cache.map((guild) => guild.memberCount)))?.flat() ?? []);
|
|
80
|
-
|
|
83
|
+
let guildLocales = [];
|
|
84
|
+
this._client.guilds.cache.map((current) => guildLocales.find((x) => x.locale === current.preferredLocale) ?
|
|
85
|
+
++guildLocales.find((x) => x.locale === current.preferredLocale).number :
|
|
86
|
+
guildLocales.push({ locale: current.preferredLocale, number: 1 }));
|
|
87
|
+
this.stats_data.guildsLocales = guildLocales;
|
|
88
|
+
await this.sendStats(this._client.user.id, guildCount, userCount, userInstallCount, guildMembers);
|
|
81
89
|
}, fast_mode ? 30000 : 300000);
|
|
82
90
|
}
|
|
83
91
|
/**
|
|
@@ -91,7 +99,6 @@ class DiscordAnalytics extends core_1.AnalyticsBase {
|
|
|
91
99
|
this.debug(`[DISCORDANALYTICS] trackInteractions(${interaction.type}) triggered`);
|
|
92
100
|
if (!this._isReady)
|
|
93
101
|
return this.error(core_1.ErrorCodes.INSTANCE_NOT_INITIALIZED);
|
|
94
|
-
this.updateOrInsert(this.stats_data.guildsLocales, (x) => x.locale === interaction.guild?.preferredLocale, (x) => x.number++, () => ({ locale: interaction.guild?.preferredLocale, number: 1 }));
|
|
95
102
|
this.updateOrInsert(this.stats_data.locales, (x) => x.locale === interaction.locale, (x) => x.number++, () => ({ locale: interaction.locale, number: 1 }));
|
|
96
103
|
if (interaction.type === core_1.InteractionType.ApplicationCommand) {
|
|
97
104
|
const commandType = interaction.command
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@discordanalytics/discordjs",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.8.0",
|
|
4
4
|
"description": "Discord.js package for working with Discord Analytics",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"author": "Discord Analytics",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"@types/node-fetch": "^2.6.13",
|
|
18
18
|
"node-fetch": "^2.7.0",
|
|
19
|
-
"@discordanalytics/core": "2.
|
|
19
|
+
"@discordanalytics/core": "2.8.0"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
22
|
"discord.js": "14.25.1",
|