xernerx 4.17.7 → 4.17.9
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/build/XernerxContextCommand.d.ts +47 -75
- package/dist/build/XernerxContextCommand.js +115 -119
- package/dist/build/XernerxEvent.d.ts +10 -10
- package/dist/build/XernerxEvent.js +17 -17
- package/dist/build/XernerxInhibitor.d.ts +15 -39
- package/dist/build/XernerxInhibitor.js +18 -18
- package/dist/build/XernerxMessageCommand.d.ts +52 -78
- package/dist/build/XernerxMessageCommand.js +114 -118
- package/dist/build/XernerxSlashCommand.d.ts +63 -97
- package/dist/build/XernerxSlashCommand.js +173 -177
- package/dist/client/XernerxClient.d.ts +55 -61
- package/dist/client/XernerxClient.js +94 -91
- package/dist/client/XernerxShardClient.d.ts +14 -14
- package/dist/client/XernerxShardClient.js +48 -61
- package/dist/functions/deploy.js +52 -45
- package/dist/functions/load.js +29 -28
- package/dist/functions/reload.js +24 -23
- package/dist/functions/setPresence.d.ts +1 -1
- package/dist/functions/setPresence.js +16 -17
- package/dist/handlers/CommandHandler.d.ts +10 -10
- package/dist/handlers/CommandHandler.js +337 -312
- package/dist/handlers/EventHandler.d.ts +5 -3
- package/dist/handlers/EventHandler.js +76 -48
- package/dist/handlers/ExtensionHandler.d.ts +3 -3
- package/dist/handlers/ExtensionHandler.js +23 -23
- package/dist/handlers/Handler.d.ts +17 -22
- package/dist/handlers/Handler.js +57 -45
- package/dist/handlers/InhibitorHandler.d.ts +3 -3
- package/dist/handlers/InhibitorHandler.js +23 -25
- package/dist/handlers/IntegrationHandler.d.ts +6 -6
- package/dist/handlers/IntegrationHandler.js +20 -20
- package/dist/main.d.ts +22 -29
- package/dist/main.js +22 -29
- package/dist/models/Arguments.d.ts +1 -4
- package/dist/models/Arguments.js +149 -134
- package/dist/models/Cooldowns.d.ts +6 -6
- package/dist/models/Cooldowns.js +29 -25
- package/dist/models/XernerxEntitlement.d.ts +45 -0
- package/dist/models/XernerxEntitlement.js +57 -0
- package/dist/models/XernerxUser.d.ts +14 -0
- package/dist/models/XernerxUser.js +13 -0
- package/dist/tools/XernerxError.d.ts +4 -4
- package/dist/tools/XernerxError.js +8 -8
- package/dist/tools/XernerxIntents.d.ts +2 -2
- package/dist/tools/XernerxIntents.js +21 -21
- package/dist/tools/XernerxLog.d.ts +25 -25
- package/dist/tools/XernerxLog.js +131 -140
- package/dist/tools/XernerxText.d.ts +23 -23
- package/dist/tools/XernerxText.js +89 -79
- package/dist/types/extenders.d.ts +47 -55
- package/dist/types/interfaces.d.ts +190 -195
- package/dist/types/types.d.ts +5 -104
- package/dist/utils/ClientUtil.d.ts +10 -12
- package/dist/utils/ClientUtil.js +117 -96
- package/dist/utils/InteractionUtil.d.ts +13 -13
- package/dist/utils/InteractionUtil.js +147 -148
- package/dist/utils/MessageUtil.d.ts +14 -14
- package/dist/utils/MessageUtil.js +161 -162
- package/dist/utils/Util.d.ts +7 -7
- package/dist/utils/Util.js +7 -7
- package/dist/validators/commandValidation.d.ts +1 -4
- package/dist/validators/commandValidation.js +114 -157
- package/dist/validators/inhibitorValidations.d.ts +2 -21
- package/dist/validators/inhibitorValidations.js +39 -39
- package/package.json +6 -5
- package/tsup.config.ts +19 -0
- package/dist/functions/xernerxUser.d.ts +0 -4
- package/dist/functions/xernerxUser.js +0 -10
|
@@ -3,7 +3,9 @@ import XernerxClient from '../client/XernerxClient.js';
|
|
|
3
3
|
import { EventHandlerOptions } from '../types/interfaces.js';
|
|
4
4
|
import Handler from './Handler.js';
|
|
5
5
|
export default class EventHandler extends Handler {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
readonly readyTimestamp: number;
|
|
7
|
+
constructor(client: XernerxClient);
|
|
8
|
+
loadEvents(options: EventHandlerOptions): Promise<void>;
|
|
9
|
+
loadStore(): Promise<void>;
|
|
10
|
+
private store;
|
|
9
11
|
}
|
|
@@ -4,53 +4,81 @@ import { Style } from 'dumfunctions';
|
|
|
4
4
|
import * as path from 'path';
|
|
5
5
|
import Handler from './Handler.js';
|
|
6
6
|
import XernerxLog from '../tools/XernerxLog.js';
|
|
7
|
+
import XernerxEntitlement from '../models/XernerxEntitlement.js';
|
|
7
8
|
export default class EventHandler extends Handler {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
9
|
+
constructor(client) {
|
|
10
|
+
super(client);
|
|
11
|
+
this.readyTimestamp = Number(Date.now());
|
|
12
|
+
}
|
|
13
|
+
async loadEvents(options) {
|
|
14
|
+
const events = [];
|
|
15
|
+
options = z
|
|
16
|
+
.object({
|
|
17
|
+
directory: z.string(),
|
|
18
|
+
})
|
|
19
|
+
.parse(options);
|
|
20
|
+
this.client.modules.options.events = options;
|
|
21
|
+
const files = await this.readdir(options.directory, 'Events');
|
|
22
|
+
for (const file of files) {
|
|
23
|
+
const filepath = `${path.resolve(options.directory)}\\${file}`;
|
|
24
|
+
const event = await this.load(filepath, 'Event');
|
|
25
|
+
this.emit(event);
|
|
26
|
+
events.push(event.id);
|
|
27
|
+
}
|
|
28
|
+
new XernerxLog(this.client).info(`Loaded ${Style.log(String(this.client.events.size), { color: Style.TextColor.Cyan })} Events: ${events.map((event) => Style.log(event, { color: Style.TextColor.LightYellow })).join(', ')}`);
|
|
29
|
+
process.on('unhandledRejection', async (error) => {
|
|
30
|
+
if (this.client.settings.ceaseless)
|
|
31
|
+
new XernerxLog(this.client).error('An uncaught error happpened, this is triggered from the ceaseless setting.', error);
|
|
32
|
+
const data = {
|
|
33
|
+
channel: null,
|
|
34
|
+
message: null,
|
|
35
|
+
user: null,
|
|
36
|
+
url: error.url || null,
|
|
37
|
+
stack: error.stack || error,
|
|
38
|
+
};
|
|
39
|
+
if (error.url) {
|
|
40
|
+
await error.url.match(/(channels|messages|servers|users)\/\d{10,100}/gim)?.map(async (identifier) => {
|
|
41
|
+
const [type, id] = identifier.split('/');
|
|
42
|
+
console.log(type, id);
|
|
43
|
+
// switch (type) {
|
|
44
|
+
// case 'channels':
|
|
45
|
+
// return (data.channel = (await this.client.channels.fetch(id)) || id);
|
|
46
|
+
// case ( 'messages' && data.channel):
|
|
47
|
+
// return (data.message = (await data.channel.messages.cache.get(id)) || id);
|
|
48
|
+
// case 'users':
|
|
49
|
+
// return (data.user = (await this.client.users.fetch(id)) || id);
|
|
50
|
+
// }
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
this.client.emit('processError', this.client, data);
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
async loadStore() {
|
|
57
|
+
this.client.on('ready', () => this.store());
|
|
58
|
+
this.client.on('entitlementCreate', () => this.store());
|
|
59
|
+
this.client.on('entitlementUpdate', () => this.store());
|
|
60
|
+
this.client.on('entitlementDelete', () => this.store());
|
|
61
|
+
}
|
|
62
|
+
async store() {
|
|
63
|
+
const entitlementsRequest = await fetch(`https://discord.com/api/v10/applications/${this.client.user?.id}/entitlements`, {
|
|
64
|
+
headers: {
|
|
65
|
+
'Authorization': `Bot ${this.client.token}`,
|
|
66
|
+
'Content-Type': 'application/json',
|
|
67
|
+
},
|
|
68
|
+
});
|
|
69
|
+
const SKUSRequest = await fetch(`https://discord.com/api/v10/applications/${this.client.user?.id}/skus`, {
|
|
70
|
+
headers: {
|
|
71
|
+
'Authorization': `Bot ${this.client.token}`,
|
|
72
|
+
'Content-Type': 'application/json',
|
|
73
|
+
},
|
|
74
|
+
});
|
|
75
|
+
if (!entitlementsRequest.ok)
|
|
76
|
+
return;
|
|
77
|
+
const entitlements = (await entitlementsRequest.json());
|
|
78
|
+
if (!SKUSRequest.ok)
|
|
79
|
+
return;
|
|
80
|
+
const skus = (await SKUSRequest.json());
|
|
81
|
+
const body = entitlements.map((item) => new XernerxEntitlement(this.client, skus.find((sku) => sku.id === item.sku_id), item));
|
|
82
|
+
this.client.store = { front: skus, archive: body.filter((item) => item.consumed), items: body.filter((item) => !item.consumed) };
|
|
83
|
+
}
|
|
56
84
|
}
|
|
@@ -3,7 +3,7 @@ import XernerxExtensionBuilder from 'xernerx-extension-builder';
|
|
|
3
3
|
import XernerxClient from '../client/XernerxClient.js';
|
|
4
4
|
import Handler from './Handler.js';
|
|
5
5
|
export default class ExtensionHandler extends Handler {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
readonly readyTimestamp: number;
|
|
7
|
+
constructor(client: XernerxClient);
|
|
8
|
+
loadExtensions(...extensions: Array<XernerxExtensionBuilder>): void;
|
|
9
9
|
}
|
|
@@ -3,27 +3,27 @@ import { Style } from 'dumfunctions';
|
|
|
3
3
|
import Handler from './Handler.js';
|
|
4
4
|
import XernerxLog from '../tools/XernerxLog.js';
|
|
5
5
|
export default class ExtensionHandler extends Handler {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
6
|
+
constructor(client) {
|
|
7
|
+
super(client);
|
|
8
|
+
this.readyTimestamp = Number(Date.now());
|
|
9
|
+
}
|
|
10
|
+
loadExtensions(...extensions) {
|
|
11
|
+
const active = extensions.map((extension) => {
|
|
12
|
+
try {
|
|
13
|
+
if (extension.main)
|
|
14
|
+
extension.main(this.client);
|
|
15
|
+
if (extension.defer) {
|
|
16
|
+
this.client.on('ready', (client) => extension.defer(client));
|
|
17
|
+
}
|
|
18
|
+
return extension.name;
|
|
19
|
+
}
|
|
20
|
+
catch (error) {
|
|
21
|
+
return new XernerxLog(this.client).error(`An error occurred while loading ${Style.log(extension.name, { color: Style.TextColor.Red })}`, error);
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
new XernerxLog(this.client).info(`Loaded ${Style.log(String(extensions.length), { color: Style.TextColor.Cyan })} Extensions: ${active
|
|
25
|
+
.filter((e) => e)
|
|
26
|
+
.map((event) => Style.log(event, { color: Style.TextColor.LightYellow }))
|
|
27
|
+
.join(', ')}`);
|
|
28
|
+
}
|
|
29
29
|
}
|
|
@@ -6,26 +6,21 @@ import XernerxContextCommand from '../build/XernerxContextCommand.js';
|
|
|
6
6
|
import { filetype } from '../types/types.js';
|
|
7
7
|
import { XernerxClientEvents, XernerxEvent, XernerxInhibitor } from '../main.js';
|
|
8
8
|
export default class Handler {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
run: Function;
|
|
27
|
-
}
|
|
28
|
-
| XernerxInhibitor
|
|
29
|
-
| XernerxEvent<keyof XernerxClientEvents>,
|
|
30
|
-
>(file: File): Promise<void>;
|
|
9
|
+
readonly client: XernerxClient<{
|
|
10
|
+
[index: string]: any;
|
|
11
|
+
[index: number]: any;
|
|
12
|
+
}>;
|
|
13
|
+
readonly files: Array<MessageCommandBuilder | XernerxSlashCommand | XernerxContextCommand>;
|
|
14
|
+
constructor(client: XernerxClient);
|
|
15
|
+
readdir(dir: string, type: string): Promise<string[]>;
|
|
16
|
+
load(filepath: string, type: filetype): Promise<any>;
|
|
17
|
+
/**
|
|
18
|
+
* Emits a file that has been loaded into the handler.
|
|
19
|
+
* @param file - The file to emit.
|
|
20
|
+
*/
|
|
21
|
+
emit<File extends {
|
|
22
|
+
name: string;
|
|
23
|
+
filetype: 'MessageCommand' | 'SlashCommand' | 'ContextCommand';
|
|
24
|
+
run: Function;
|
|
25
|
+
} | XernerxInhibitor | XernerxEvent<keyof XernerxClientEvents>>(file: File): Promise<void>;
|
|
31
26
|
}
|
package/dist/handlers/Handler.js
CHANGED
|
@@ -4,49 +4,61 @@ import * as path from 'path';
|
|
|
4
4
|
import load from '../functions/load.js';
|
|
5
5
|
import { Style, XernerxLog } from '../main.js';
|
|
6
6
|
export default class Handler {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
7
|
+
client;
|
|
8
|
+
files;
|
|
9
|
+
constructor(client) {
|
|
10
|
+
this.client = client;
|
|
11
|
+
this.files = [];
|
|
12
|
+
}
|
|
13
|
+
async readdir(dir, type) {
|
|
14
|
+
try {
|
|
15
|
+
return fs.readdirSync(path.resolve(dir)).filter((file) => file.endsWith('.js'));
|
|
16
|
+
}
|
|
17
|
+
catch (error) {
|
|
18
|
+
new XernerxLog(this.client).error(`Cannot load ${type.toLowerCase()}, there is no such directory ${Style.log(dir, { color: Style.BackgroundColor.Grey })}.`);
|
|
19
|
+
}
|
|
20
|
+
return [];
|
|
21
|
+
}
|
|
22
|
+
async load(filepath, type) {
|
|
23
|
+
const file = await load(this.client, filepath, type);
|
|
24
|
+
if (this.client.settings.debug)
|
|
25
|
+
new XernerxLog(this.client).debug(`Loaded ${Style.log(type, { color: Style.TextColor.Blue })} ${Style.log(file.name, { color: Style.TextColor.Yellow })}`);
|
|
26
|
+
this.files.push(file);
|
|
27
|
+
return file;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Emits a file that has been loaded into the handler.
|
|
31
|
+
* @param file - The file to emit.
|
|
32
|
+
*/
|
|
33
|
+
async emit(file) {
|
|
34
|
+
if (!file?.filetype)
|
|
35
|
+
return;
|
|
36
|
+
if (file.filetype === 'Inhibitor')
|
|
37
|
+
return;
|
|
38
|
+
if (file.filetype === 'Event' && file.emitter) {
|
|
39
|
+
if (file.emitter === 'client') {
|
|
40
|
+
if (this.client.settings.debug)
|
|
41
|
+
new XernerxLog(this.client).debug(`Listening to client event ${Style.log(file.name, { color: Style.TextColor.Yellow })}`);
|
|
42
|
+
this.client[file.once ? 'once' : 'on'](file.name, (...args) => file.run(...args));
|
|
43
|
+
}
|
|
44
|
+
else if (file.emitter === 'process') {
|
|
45
|
+
if (this.client.settings.debug)
|
|
46
|
+
new XernerxLog(this.client).debug(`Listening to process event ${Style.log(file.name, { color: Style.TextColor.Yellow })}`);
|
|
47
|
+
process[file.once ? 'once' : 'on'](file.name, (...args) => file.run(...args));
|
|
48
|
+
}
|
|
49
|
+
else if (file.emitter === 'rest') {
|
|
50
|
+
if (this.client.settings.debug)
|
|
51
|
+
new XernerxLog(this.client).debug(`Listening to rest event ${Style.log(file.name, { color: Style.TextColor.Yellow })}`);
|
|
52
|
+
// @ts-expect-error
|
|
53
|
+
this.client.rest[file.once ? 'once' : 'on'](file.name, (...args) => file.run(...args));
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
// @ts-expect-error
|
|
57
|
+
this.client[file.emitter][file.once ? 'once' : 'on'](file.name, (...args) => file.run(...args));
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
this.client.on(file.name, (...args) => file.run(...args));
|
|
62
|
+
}
|
|
63
|
+
}
|
|
52
64
|
}
|
|
@@ -3,7 +3,7 @@ import XernerxClient from '../client/XernerxClient.js';
|
|
|
3
3
|
import Handler from './Handler.js';
|
|
4
4
|
import { InhibitorHandlerOptions } from '../types/interfaces.js';
|
|
5
5
|
export default class InhibitorHandler extends Handler {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
readonly readyTimestamp: number;
|
|
7
|
+
constructor(client: XernerxClient);
|
|
8
|
+
loadInhibitors(options: InhibitorHandlerOptions): Promise<void>;
|
|
9
9
|
}
|
|
@@ -5,29 +5,27 @@ import { Style } from 'dumfunctions';
|
|
|
5
5
|
import Handler from './Handler.js';
|
|
6
6
|
import XernerxLog from '../tools/XernerxLog.js';
|
|
7
7
|
export default class InhibitorHandler extends Handler {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
);
|
|
32
|
-
}
|
|
8
|
+
constructor(client) {
|
|
9
|
+
super(client);
|
|
10
|
+
this.readyTimestamp = Number(Date.now());
|
|
11
|
+
}
|
|
12
|
+
async loadInhibitors(options) {
|
|
13
|
+
const inhibitors = [];
|
|
14
|
+
options = z
|
|
15
|
+
.object({
|
|
16
|
+
directory: z.string(),
|
|
17
|
+
})
|
|
18
|
+
.parse(options);
|
|
19
|
+
this.client.modules.options.inhibitors = options;
|
|
20
|
+
const files = await this.readdir(options.directory, 'Inhibitors');
|
|
21
|
+
for (const file of files) {
|
|
22
|
+
const filepath = `${path.resolve(options.directory)}\\${file}`;
|
|
23
|
+
const inhibitor = await this.load(filepath, 'Inhibitor');
|
|
24
|
+
this.emit(inhibitor);
|
|
25
|
+
inhibitors.push(inhibitor.id);
|
|
26
|
+
}
|
|
27
|
+
new XernerxLog(this.client).info(`Loaded ${Style.log(String(this.client.inhibitors.size), { color: Style.TextColor.Cyan })} Inhibitors: ${inhibitors
|
|
28
|
+
.map((inhibitor) => Style.log(inhibitor, { color: Style.TextColor.LightYellow }))
|
|
29
|
+
.join(', ')}`);
|
|
30
|
+
}
|
|
33
31
|
}
|
|
@@ -3,13 +3,13 @@ import dbl from 'dbl-sdk';
|
|
|
3
3
|
import XernerxClient from '../client/XernerxClient.js';
|
|
4
4
|
import Handler from './Handler.js';
|
|
5
5
|
export default class IntegrationHandler extends Handler {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
readonly readyTimestamp: number;
|
|
7
|
+
readonly dbl: dbl;
|
|
8
|
+
constructor(client: XernerxClient);
|
|
9
|
+
loadIntegrations(options?: DBLOptions): Promise<void>;
|
|
10
10
|
}
|
|
11
11
|
interface DBLOptions {
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
post?: boolean;
|
|
13
|
+
votes?: boolean;
|
|
14
14
|
}
|
|
15
15
|
export {};
|
|
@@ -3,24 +3,24 @@ import dbl from 'dbl-sdk';
|
|
|
3
3
|
import XernerxLog from '../tools/XernerxLog.js';
|
|
4
4
|
import Handler from './Handler.js';
|
|
5
5
|
export default class IntegrationHandler extends Handler {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
6
|
+
constructor(client) {
|
|
7
|
+
super(client);
|
|
8
|
+
this.dbl = new dbl(client, client.config);
|
|
9
|
+
this.readyTimestamp = Number(Date.now());
|
|
10
|
+
}
|
|
11
|
+
async loadIntegrations(options = { votes: true }) {
|
|
12
|
+
this.client.once('ready', async (client) => {
|
|
13
|
+
this.client.dbl.validate = (user) => this.dbl.validate(user);
|
|
14
|
+
if (options.post) {
|
|
15
|
+
this.dbl.post();
|
|
16
|
+
}
|
|
17
|
+
if (options.votes) {
|
|
18
|
+
this.dbl.votes();
|
|
19
|
+
this.client.on('dbl-sync', (client, responses) => {
|
|
20
|
+
this.client.stats.voteCount = responses.voteCount;
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
new XernerxLog(this.client).info(`Successfully syncing with top.gg.`);
|
|
25
|
+
}
|
|
26
26
|
}
|
package/dist/main.d.ts
CHANGED
|
@@ -11,37 +11,30 @@ import XernerxLog from './tools/XernerxLog.js';
|
|
|
11
11
|
export { XernerxIntents } from './tools/XernerxIntents.js';
|
|
12
12
|
export * from 'discord.js';
|
|
13
13
|
export * from 'dumfunctions';
|
|
14
|
-
import Discord from 'discord.js';
|
|
14
|
+
import * as Discord from 'discord.js';
|
|
15
15
|
import XernerxExtension from 'xernerx-extension-builder';
|
|
16
16
|
export * from './types/types.js';
|
|
17
17
|
export * from './types/extenders.js';
|
|
18
18
|
export * from './types/interfaces.js';
|
|
19
19
|
export default XernerxClient;
|
|
20
|
-
export {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
*/
|
|
42
|
-
version,
|
|
43
|
-
/**
|
|
44
|
-
** Tools
|
|
45
|
-
*/
|
|
46
|
-
XernerxLog,
|
|
47
|
-
};
|
|
20
|
+
export {
|
|
21
|
+
/**
|
|
22
|
+
** Clients
|
|
23
|
+
*/
|
|
24
|
+
XernerxClient, XernerxShardClient,
|
|
25
|
+
/**
|
|
26
|
+
** Builders
|
|
27
|
+
*/
|
|
28
|
+
XernerxMessageCommand, XernerxSlashCommand, XernerxContextCommand, XernerxEvent, XernerxInhibitor, XernerxExtension,
|
|
29
|
+
/**
|
|
30
|
+
** Imported exports
|
|
31
|
+
*/
|
|
32
|
+
Discord,
|
|
33
|
+
/**
|
|
34
|
+
** Properties
|
|
35
|
+
*/
|
|
36
|
+
version,
|
|
37
|
+
/**
|
|
38
|
+
** Tools
|
|
39
|
+
*/
|
|
40
|
+
XernerxLog, };
|
package/dist/main.js
CHANGED
|
@@ -13,37 +13,30 @@ import XernerxLog from './tools/XernerxLog.js';
|
|
|
13
13
|
export { XernerxIntents } from './tools/XernerxIntents.js';
|
|
14
14
|
export * from 'discord.js';
|
|
15
15
|
export * from 'dumfunctions';
|
|
16
|
-
import Discord from 'discord.js';
|
|
16
|
+
import * as Discord from 'discord.js';
|
|
17
17
|
import XernerxExtension from 'xernerx-extension-builder';
|
|
18
18
|
export * from './types/types.js';
|
|
19
19
|
export * from './types/extenders.js';
|
|
20
20
|
export * from './types/interfaces.js';
|
|
21
21
|
export default XernerxClient;
|
|
22
|
-
export {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
*/
|
|
44
|
-
version,
|
|
45
|
-
/**
|
|
46
|
-
** Tools
|
|
47
|
-
*/
|
|
48
|
-
XernerxLog,
|
|
49
|
-
};
|
|
22
|
+
export {
|
|
23
|
+
/**
|
|
24
|
+
** Clients
|
|
25
|
+
*/
|
|
26
|
+
XernerxClient, XernerxShardClient,
|
|
27
|
+
/**
|
|
28
|
+
** Builders
|
|
29
|
+
*/
|
|
30
|
+
XernerxMessageCommand, XernerxSlashCommand, XernerxContextCommand, XernerxEvent, XernerxInhibitor, XernerxExtension,
|
|
31
|
+
/**
|
|
32
|
+
** Imported exports
|
|
33
|
+
*/
|
|
34
|
+
Discord,
|
|
35
|
+
/**
|
|
36
|
+
** Properties
|
|
37
|
+
*/
|
|
38
|
+
version,
|
|
39
|
+
/**
|
|
40
|
+
** Tools
|
|
41
|
+
*/
|
|
42
|
+
XernerxLog, };
|
|
@@ -6,7 +6,4 @@ import { XernerxMessage, XernerxMessageContextInteraction, XernerxSlashInteracti
|
|
|
6
6
|
import { MessageCommandArguments } from '../types/interfaces.js';
|
|
7
7
|
import { XernerxInteraction } from '../types/types.js';
|
|
8
8
|
export declare function messageArguments(message: XernerxMessage, command: MessageCommandBuilder, prefix: string): Promise<MessageCommandArguments>;
|
|
9
|
-
export declare function interactionArguments(
|
|
10
|
-
interaction: XernerxInteraction<XernerxSlashInteraction | XernerxUserContextInteraction | XernerxMessageContextInteraction> | any,
|
|
11
|
-
command: XernerxContextCommand | XernerxSlashCommand
|
|
12
|
-
): Promise<any>;
|
|
9
|
+
export declare function interactionArguments(interaction: XernerxInteraction<XernerxSlashInteraction | XernerxUserContextInteraction | XernerxMessageContextInteraction> | any, command: XernerxContextCommand | XernerxSlashCommand): Promise<any>;
|