@discordanalytics/core 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.
Files changed (2) hide show
  1. package/dist/index.js +6 -7
  2. package/package.json +1 -5
package/dist/index.js CHANGED
@@ -13,13 +13,9 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
13
13
  var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
- var __importDefault = (this && this.__importDefault) || function (mod) {
17
- return (mod && mod.__esModule) ? mod : { "default": mod };
18
- };
19
16
  Object.defineProperty(exports, "__esModule", { value: true });
20
17
  exports.CustomEvent = exports.AnalyticsBase = void 0;
21
18
  const types_1 = require("./types");
22
- const node_fetch_1 = __importDefault(require("node-fetch"));
23
19
  /**
24
20
  * DiscordAnalytics Base Class
25
21
  * @class AnalyticsBase
@@ -59,6 +55,7 @@ class AnalyticsBase {
59
55
  private_message: 0,
60
56
  },
61
57
  custom_events: {},
58
+ user_install_count: 0,
62
59
  };
63
60
  client_id = '';
64
61
  constructor(api_key, debug = false) {
@@ -136,14 +133,14 @@ class AnalyticsBase {
136
133
  * @param body The body to send (optional)
137
134
  * @param max_retries The maximum number of retries (default: 5)
138
135
  * @param backoff_factor The backoff factor to use (default: 0.5)
139
- * @returns {Promise<void | fetch.Response>} The response from the API
136
+ * @returns {Promise<void | Response>} The response from the API
140
137
  */
141
138
  async api_call_with_retries(method, url, body, max_retries = 5, backoff_factor = 0.5) {
142
139
  let retries = 0;
143
140
  let response;
144
141
  while (retries < max_retries) {
145
142
  try {
146
- response = await (0, node_fetch_1.default)(url, {
143
+ response = await fetch(url, {
147
144
  method,
148
145
  headers: this._headers,
149
146
  body,
@@ -174,10 +171,11 @@ class AnalyticsBase {
174
171
  * @param client_id The client ID of the bot
175
172
  * @param guild_count The number of guilds the bot is in (default: 0)
176
173
  * @param user_count The number of users the bot is in (default: 0)
174
+ * @param user_install_count The number of user installs (default: 0)
177
175
  * @param guild_members The number of members in each guild (optional)
178
176
  * @returns {Promise<void>} A promise that resolves when the stats are sent
179
177
  */
180
- async sendStats(client_id, guild_count = 0, user_count = 0, guild_members = []) {
178
+ async sendStats(client_id, guild_count = 0, user_count = 0, user_install_count = 0, guild_members = []) {
181
179
  this.debug('[DISCORDANALYTICS] Sending stats...');
182
180
  const url = types_1.ApiEndpoints.EDIT_STATS_URL.replace(':id', client_id);
183
181
  const body = JSON.stringify(this.stats_data);
@@ -202,6 +200,7 @@ class AnalyticsBase {
202
200
  private_message: 0,
203
201
  },
204
202
  custom_events: this.stats_data.custom_events,
203
+ user_install_count,
205
204
  };
206
205
  }
207
206
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@discordanalytics/core",
3
- "version": "2.6.2",
3
+ "version": "2.8.0",
4
4
  "description": "Core package to work with Discord Analytics",
5
5
  "main": "dist/index.js",
6
6
  "author": "Discord Analytics",
@@ -13,10 +13,6 @@
13
13
  "bugs": {
14
14
  "url": "https://github.com/DiscordAnalytics/node-package/issues"
15
15
  },
16
- "dependencies": {
17
- "@types/node-fetch": "^2.6.13",
18
- "node-fetch": "^2.7.0"
19
- },
20
16
  "devDependencies": {
21
17
  "@types/node": "*",
22
18
  "typescript": "*"