@discordanalytics/discordjs-light 2.8.0 → 2.8.2

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.d.ts +54 -0
  2. package/package.json +6 -4
@@ -0,0 +1,54 @@
1
+ import { AnalyticsBase, AnalyticsOptions } from '@discordanalytics/core';
2
+ /**
3
+ * @class DiscordAnalytics
4
+ * @description The Discord.js-light class for the DiscordAnalytics library.
5
+ * @param {AnalyticsOptions} options - Configuration options.
6
+ * @property {any} options.client The Discord.js-light client to track events for.
7
+ * @property {string} options.api_key The API token for DiscordAnalytics.
8
+ * @property {boolean} options.sharded Whether the Discord.js-light client is sharded.
9
+ * @property {boolean} options.debug Enable or not the debug mode /!\ MUST BE USED ONLY FOR DEVELOPMENT PURPOSES /!\
10
+ * @example
11
+ * const { default: DiscordAnalytics } = require('discord-analytics/discord.js-light');
12
+ * const { Client, IntentsBitField } = require('discord.js-light');
13
+ * const client = new Client({
14
+ * intents: ['GUILDS']
15
+ * })
16
+ * client.on('ready', () => {
17
+ * const analytics = new DiscordAnalytics({
18
+ * client: client,
19
+ * api_key: 'YOUR_API_TOKEN'
20
+ * });
21
+ * analytics.init();
22
+ * analytics.trackEvents();
23
+ * });
24
+ * client.login('YOUR_BOT_TOKEN');
25
+ * @link https://discordanalytics.xyz/docs/main/get-started/installation/discord.js Check docs for more informations about advanced usages
26
+ */
27
+ export default class DiscordAnalytics extends AnalyticsBase {
28
+ private readonly _client;
29
+ private readonly _sharded;
30
+ private _isReady;
31
+ constructor(options: AnalyticsOptions);
32
+ /**
33
+ * Initialize DiscordAnalytics on your bot
34
+ * /!\ Advanced users only
35
+ * /!\ Required to use DiscordAnalytics
36
+ * /!\ Must be used when the client is ready (recommended to use in ready event to prevent problems)
37
+ */
38
+ init(): Promise<void>;
39
+ /**
40
+ * Track interactions
41
+ * /!\ Advanced users only
42
+ * /!\ You need to initialize the class first
43
+ * @param interaction BaseInteraction class and its extensions only
44
+ * @param interactionNameResolver A function that will resolve the name of the interaction
45
+ */
46
+ trackInteractions(interaction: any, interactionNameResolver?: (interaction: any) => string): Promise<void>;
47
+ /**
48
+ * Let DiscordAnalytics declare the events necessary for its operation.
49
+ * /!\ Not recommended for big bots
50
+ * /!\ Not compatible with other functions
51
+ * @param interactionNameResolver A function that will resolve the name of the interaction
52
+ */
53
+ trackEvents(interactionNameResolver?: (interaction: any) => string): void;
54
+ }
package/package.json CHANGED
@@ -1,8 +1,12 @@
1
1
  {
2
2
  "name": "@discordanalytics/discordjs-light",
3
- "version": "2.8.0",
3
+ "version": "2.8.2",
4
4
  "description": "Discord.js light package for working with Discord Analytics",
5
+ "files": [
6
+ "dist"
7
+ ],
5
8
  "main": "dist/index.js",
9
+ "types": "dist/index.d.ts",
6
10
  "author": "Discord Analytics",
7
11
  "homepage": "https://discordanalytics.xyz",
8
12
  "readme": "README.md",
@@ -14,9 +18,7 @@
14
18
  "url": "https://github.com/DiscordAnalytics/node-package/issues"
15
19
  },
16
20
  "dependencies": {
17
- "@types/node-fetch": "^2.6.13",
18
- "node-fetch": "^2.7.0",
19
- "@discordanalytics/core": "2.8.0"
21
+ "@discordanalytics/core": "2.8.2"
20
22
  },
21
23
  "devDependencies": {
22
24
  "discord.js-light": "^4.10.0",