xernerx 4.0.1 → 4.0.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.
- package/dist/functions/setPresence.d.ts +3 -0
- package/dist/functions/setPresence.js +19 -0
- package/dist/handlers/ExtensionHandler.js +3 -3
- package/dist/main.d.ts +3 -1
- package/dist/main.js +3 -1
- package/dist/tools/package.d.ts +1 -0
- package/dist/tools/package.js +3 -2
- package/dist/types/interfaces.d.ts +8 -1
- package/dist/utils/ClientUtil.d.ts +2 -0
- package/dist/utils/ClientUtil.js +4 -0
- package/package.json +1 -1
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export default function setPresence(client, options) {
|
|
2
|
+
const presence = () =>
|
|
3
|
+
client.user?.setPresence({
|
|
4
|
+
activities: [
|
|
5
|
+
{
|
|
6
|
+
name: options.text,
|
|
7
|
+
type: options.type,
|
|
8
|
+
url: options.url,
|
|
9
|
+
},
|
|
10
|
+
],
|
|
11
|
+
status: options.status,
|
|
12
|
+
});
|
|
13
|
+
let response = presence();
|
|
14
|
+
if (options.interval)
|
|
15
|
+
setInterval(() => {
|
|
16
|
+
response = presence();
|
|
17
|
+
}, options.interval);
|
|
18
|
+
return response;
|
|
19
|
+
}
|
|
@@ -7,11 +7,11 @@ export default class ExtensionHandler extends Handler {
|
|
|
7
7
|
loadExtensions(...extensions) {
|
|
8
8
|
const active = extensions.map((extension) => {
|
|
9
9
|
try {
|
|
10
|
-
extension.main(this.client);
|
|
11
|
-
extension.await(this.client);
|
|
10
|
+
if (extension.main) extension.main(this.client);
|
|
11
|
+
if (extension.await) extension.await(this.client);
|
|
12
12
|
return extension.name;
|
|
13
13
|
} catch (error) {
|
|
14
|
-
new XernerxLog(this.client).error(`An error occurred while loading ${extension.name}
|
|
14
|
+
new XernerxLog(this.client).error(`An error occurred while loading ${extension.name}`, error);
|
|
15
15
|
}
|
|
16
16
|
});
|
|
17
17
|
new XernerxLog(this.client).info(`Loaded Extensions: ${active.filter((e) => e).join(', ')}`);
|
package/dist/main.d.ts
CHANGED
|
@@ -8,4 +8,6 @@ export default XernerxClient;
|
|
|
8
8
|
export * from 'discord.js';
|
|
9
9
|
export * from 'dumfunctions';
|
|
10
10
|
import ExtensionBuilder from 'xernerx-extension-builder';
|
|
11
|
-
|
|
11
|
+
import Discord from 'discord.js';
|
|
12
|
+
declare const version = '4.0.2';
|
|
13
|
+
export { XernerxClient, MessageCommandBuilder, SlashCommandBuilder, ContextCommandBuilder, EventBuilder, InhibitorBuilder, ExtensionBuilder, Discord, version };
|
package/dist/main.js
CHANGED
|
@@ -8,4 +8,6 @@ export default XernerxClient;
|
|
|
8
8
|
export * from 'discord.js';
|
|
9
9
|
export * from 'dumfunctions';
|
|
10
10
|
import ExtensionBuilder from 'xernerx-extension-builder';
|
|
11
|
-
|
|
11
|
+
import Discord from 'discord.js';
|
|
12
|
+
const version = '4.0.2';
|
|
13
|
+
export { XernerxClient, MessageCommandBuilder, SlashCommandBuilder, ContextCommandBuilder, EventBuilder, InhibitorBuilder, ExtensionBuilder, Discord, version };
|
package/dist/tools/package.d.ts
CHANGED
package/dist/tools/package.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export default {
|
|
2
2
|
name: 'xernerx',
|
|
3
|
-
version: '4.0.
|
|
3
|
+
version: '4.0.1',
|
|
4
4
|
description: 'A bot framework for discord.js.',
|
|
5
5
|
main: 'dist/main.js',
|
|
6
6
|
type: 'module',
|
|
@@ -28,9 +28,10 @@ export default {
|
|
|
28
28
|
url: 'https://github.com/xernerx/xernerx/issues',
|
|
29
29
|
},
|
|
30
30
|
dependencies: {
|
|
31
|
+
'dbl-sdk': '^1.2.0',
|
|
31
32
|
'discord.js': '^14.9.0',
|
|
32
33
|
dumfunctions: '^2.1.2',
|
|
33
|
-
'xernerx-extension-builder': '^0.0.
|
|
34
|
+
'xernerx-extension-builder': '^0.0.12',
|
|
34
35
|
zod: '^3.21.4',
|
|
35
36
|
},
|
|
36
37
|
devDependencies: {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ChannelType, Collection } from 'discord.js';
|
|
1
|
+
import { ActivityType, ChannelType, Collection, PresenceStatusData } from 'discord.js';
|
|
2
2
|
import CommandHandler from '../handlers/CommandHandler.js';
|
|
3
3
|
import EventHandler from '../handlers/EventHandler.js';
|
|
4
4
|
import InhibitorHandler from '../handlers/InhibitorHandler.js';
|
|
@@ -221,4 +221,11 @@ export interface InhibitorBuilderOptions {
|
|
|
221
221
|
name: string;
|
|
222
222
|
type: InhibitorType;
|
|
223
223
|
}
|
|
224
|
+
export interface PresenceOptions {
|
|
225
|
+
text: string;
|
|
226
|
+
type?: ActivityType.Playing | ActivityType.Streaming | ActivityType.Listening | ActivityType.Watching | ActivityType.Competing;
|
|
227
|
+
url: string;
|
|
228
|
+
status?: PresenceStatusData;
|
|
229
|
+
interval?: number;
|
|
230
|
+
}
|
|
224
231
|
export {};
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import XernerxClient from '../main.js';
|
|
2
|
+
import { PresenceOptions } from '../types/interfaces.js';
|
|
2
3
|
import Util from './Util.js';
|
|
3
4
|
export default class ClientUtil extends Util {
|
|
4
5
|
hasVoted?: Function;
|
|
5
6
|
constructor(client: XernerxClient);
|
|
7
|
+
setPresence(options: PresenceOptions): import('discord.js').ClientPresence | undefined;
|
|
6
8
|
}
|
package/dist/utils/ClientUtil.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
|
+
import setPresence from '../functions/setPresence.js';
|
|
1
2
|
import Util from './Util.js';
|
|
2
3
|
export default class ClientUtil extends Util {
|
|
3
4
|
hasVoted;
|
|
4
5
|
constructor(client) {
|
|
5
6
|
super(client);
|
|
6
7
|
}
|
|
8
|
+
setPresence(options) {
|
|
9
|
+
return setPresence(this.client, options);
|
|
10
|
+
}
|
|
7
11
|
}
|