xernerx 4.15.0 → 4.15.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/{cjs/utils → utils}/InteractionUtil.d.ts +1 -1
- package/dist/{mjs/utils → utils}/InteractionUtil.js +4 -3
- package/dist/{cjs/utils → utils}/MessageUtil.d.ts +1 -1
- package/dist/{mjs/utils → utils}/MessageUtil.js +4 -3
- package/package.json +3 -4
- package/dist/cjs/build/XernerxContextCommand.js +0 -124
- package/dist/cjs/build/XernerxEvent.js +0 -34
- package/dist/cjs/build/XernerxInhibitor.js +0 -30
- package/dist/cjs/build/XernerxMessageCommand.js +0 -122
- package/dist/cjs/build/XernerxSlashCommand.js +0 -180
- package/dist/cjs/client/XernerxClient.js +0 -105
- package/dist/cjs/client/XernerxShardClient.js +0 -56
- package/dist/cjs/functions/deploy.js +0 -66
- package/dist/cjs/functions/load.js +0 -38
- package/dist/cjs/functions/reload.js +0 -33
- package/dist/cjs/functions/setPresence.js +0 -24
- package/dist/cjs/functions/xernerxUser.js +0 -15
- package/dist/cjs/handlers/CommandHandler.js +0 -342
- package/dist/cjs/handlers/EventHandler.js +0 -32
- package/dist/cjs/handlers/ExtensionHandler.js +0 -32
- package/dist/cjs/handlers/Handler.js +0 -48
- package/dist/cjs/handlers/InhibitorHandler.js +0 -34
- package/dist/cjs/handlers/IntegrationHandler.js +0 -29
- package/dist/cjs/main.js +0 -36
- package/dist/cjs/models/Arguments.js +0 -159
- package/dist/cjs/models/Cooldowns.js +0 -36
- package/dist/cjs/tools/XernerxError.js +0 -14
- package/dist/cjs/tools/XernerxIntents.js +0 -27
- package/dist/cjs/tools/XernerxLog.js +0 -98
- package/dist/cjs/tools/XernerxText.js +0 -92
- package/dist/cjs/types/extenders.js +0 -3
- package/dist/cjs/types/interfaces.js +0 -3
- package/dist/cjs/types/types.js +0 -3
- package/dist/cjs/utils/ClientUtil.js +0 -84
- package/dist/cjs/utils/InteractionUtil.js +0 -156
- package/dist/cjs/utils/MessageUtil.js +0 -170
- package/dist/cjs/utils/Util.js +0 -14
- package/dist/cjs/validators/commandValidation.js +0 -127
- package/dist/cjs/validators/inhibitorValidations.js +0 -49
- package/dist/mjs/build/XernerxContextCommand.d.ts +0 -53
- package/dist/mjs/build/XernerxEvent.d.ts +0 -25
- package/dist/mjs/build/XernerxInhibitor.d.ts +0 -29
- package/dist/mjs/build/XernerxMessageCommand.d.ts +0 -57
- package/dist/mjs/build/XernerxSlashCommand.d.ts +0 -69
- package/dist/mjs/client/XernerxClient.d.ts +0 -53
- package/dist/mjs/client/XernerxShardClient.d.ts +0 -21
- package/dist/mjs/functions/deploy.d.ts +0 -3
- package/dist/mjs/functions/load.d.ts +0 -4
- package/dist/mjs/functions/reload.d.ts +0 -3
- package/dist/mjs/functions/setPresence.d.ts +0 -4
- package/dist/mjs/functions/xernerxUser.d.ts +0 -4
- package/dist/mjs/handlers/CommandHandler.d.ts +0 -16
- package/dist/mjs/handlers/EventHandler.d.ts +0 -9
- package/dist/mjs/handlers/ExtensionHandler.d.ts +0 -9
- package/dist/mjs/handlers/Handler.d.ts +0 -14
- package/dist/mjs/handlers/InhibitorHandler.d.ts +0 -9
- package/dist/mjs/handlers/IntegrationHandler.d.ts +0 -15
- package/dist/mjs/main.d.ts +0 -40
- package/dist/mjs/models/Arguments.d.ts +0 -9
- package/dist/mjs/models/Cooldowns.d.ts +0 -11
- package/dist/mjs/tools/XernerxError.d.ts +0 -7
- package/dist/mjs/tools/XernerxIntents.d.ts +0 -5
- package/dist/mjs/tools/XernerxLog.d.ts +0 -28
- package/dist/mjs/tools/XernerxText.d.ts +0 -30
- package/dist/mjs/types/extenders.d.ts +0 -61
- package/dist/mjs/types/interfaces.d.ts +0 -256
- package/dist/mjs/types/types.d.ts +0 -14
- package/dist/mjs/utils/ClientUtil.d.ts +0 -19
- package/dist/mjs/utils/InteractionUtil.d.ts +0 -25
- package/dist/mjs/utils/MessageUtil.d.ts +0 -26
- package/dist/mjs/utils/Util.d.ts +0 -9
- package/dist/mjs/validators/commandValidation.d.ts +0 -7
- package/dist/mjs/validators/inhibitorValidations.d.ts +0 -9
- /package/dist/{cjs/build → build}/XernerxContextCommand.d.ts +0 -0
- /package/dist/{mjs/build → build}/XernerxContextCommand.js +0 -0
- /package/dist/{cjs/build → build}/XernerxEvent.d.ts +0 -0
- /package/dist/{mjs/build → build}/XernerxEvent.js +0 -0
- /package/dist/{cjs/build → build}/XernerxInhibitor.d.ts +0 -0
- /package/dist/{mjs/build → build}/XernerxInhibitor.js +0 -0
- /package/dist/{cjs/build → build}/XernerxMessageCommand.d.ts +0 -0
- /package/dist/{mjs/build → build}/XernerxMessageCommand.js +0 -0
- /package/dist/{cjs/build → build}/XernerxSlashCommand.d.ts +0 -0
- /package/dist/{mjs/build → build}/XernerxSlashCommand.js +0 -0
- /package/dist/{cjs/client → client}/XernerxClient.d.ts +0 -0
- /package/dist/{mjs/client → client}/XernerxClient.js +0 -0
- /package/dist/{cjs/client → client}/XernerxShardClient.d.ts +0 -0
- /package/dist/{mjs/client → client}/XernerxShardClient.js +0 -0
- /package/dist/{cjs/functions → functions}/deploy.d.ts +0 -0
- /package/dist/{mjs/functions → functions}/deploy.js +0 -0
- /package/dist/{cjs/functions → functions}/load.d.ts +0 -0
- /package/dist/{mjs/functions → functions}/load.js +0 -0
- /package/dist/{cjs/functions → functions}/reload.d.ts +0 -0
- /package/dist/{mjs/functions → functions}/reload.js +0 -0
- /package/dist/{cjs/functions → functions}/setPresence.d.ts +0 -0
- /package/dist/{mjs/functions → functions}/setPresence.js +0 -0
- /package/dist/{cjs/functions → functions}/xernerxUser.d.ts +0 -0
- /package/dist/{mjs/functions → functions}/xernerxUser.js +0 -0
- /package/dist/{cjs/handlers → handlers}/CommandHandler.d.ts +0 -0
- /package/dist/{mjs/handlers → handlers}/CommandHandler.js +0 -0
- /package/dist/{cjs/handlers → handlers}/EventHandler.d.ts +0 -0
- /package/dist/{mjs/handlers → handlers}/EventHandler.js +0 -0
- /package/dist/{cjs/handlers → handlers}/ExtensionHandler.d.ts +0 -0
- /package/dist/{mjs/handlers → handlers}/ExtensionHandler.js +0 -0
- /package/dist/{cjs/handlers → handlers}/Handler.d.ts +0 -0
- /package/dist/{mjs/handlers → handlers}/Handler.js +0 -0
- /package/dist/{cjs/handlers → handlers}/InhibitorHandler.d.ts +0 -0
- /package/dist/{mjs/handlers → handlers}/InhibitorHandler.js +0 -0
- /package/dist/{cjs/handlers → handlers}/IntegrationHandler.d.ts +0 -0
- /package/dist/{mjs/handlers → handlers}/IntegrationHandler.js +0 -0
- /package/dist/{cjs/main.d.ts → main.d.ts} +0 -0
- /package/dist/{mjs/main.js → main.js} +0 -0
- /package/dist/{cjs/models → models}/Arguments.d.ts +0 -0
- /package/dist/{mjs/models → models}/Arguments.js +0 -0
- /package/dist/{cjs/models → models}/Cooldowns.d.ts +0 -0
- /package/dist/{mjs/models → models}/Cooldowns.js +0 -0
- /package/dist/{cjs/tools → tools}/XernerxError.d.ts +0 -0
- /package/dist/{mjs/tools → tools}/XernerxError.js +0 -0
- /package/dist/{cjs/tools → tools}/XernerxIntents.d.ts +0 -0
- /package/dist/{mjs/tools → tools}/XernerxIntents.js +0 -0
- /package/dist/{cjs/tools → tools}/XernerxLog.d.ts +0 -0
- /package/dist/{mjs/tools → tools}/XernerxLog.js +0 -0
- /package/dist/{cjs/tools → tools}/XernerxText.d.ts +0 -0
- /package/dist/{mjs/tools → tools}/XernerxText.js +0 -0
- /package/dist/{cjs/types → types}/extenders.d.ts +0 -0
- /package/dist/{mjs/types → types}/extenders.js +0 -0
- /package/dist/{cjs/types → types}/interfaces.d.ts +0 -0
- /package/dist/{mjs/types → types}/interfaces.js +0 -0
- /package/dist/{cjs/types → types}/types.d.ts +0 -0
- /package/dist/{mjs/types → types}/types.js +0 -0
- /package/dist/{cjs/utils → utils}/ClientUtil.d.ts +0 -0
- /package/dist/{mjs/utils → utils}/ClientUtil.js +0 -0
- /package/dist/{cjs/utils → utils}/Util.d.ts +0 -0
- /package/dist/{mjs/utils → utils}/Util.js +0 -0
- /package/dist/{cjs/validators → validators}/commandValidation.d.ts +0 -0
- /package/dist/{mjs/validators → validators}/commandValidation.js +0 -0
- /package/dist/{cjs/validators → validators}/inhibitorValidations.d.ts +0 -0
- /package/dist/{mjs/validators → validators}/inhibitorValidations.js +0 -0
|
@@ -1,159 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/** @format */
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.interactionArguments = exports.messageArguments = void 0;
|
|
5
|
-
async function messageArguments(message, command, prefix) {
|
|
6
|
-
const separator = command.separator || ' ', content = message.content
|
|
7
|
-
.replace(new RegExp(`${prefix} +?`), '')
|
|
8
|
-
.split(separator)
|
|
9
|
-
.slice(1);
|
|
10
|
-
let args = {}, flags = {};
|
|
11
|
-
if (command.flags)
|
|
12
|
-
command.flags.map((flag) => {
|
|
13
|
-
if (!flags)
|
|
14
|
-
flags = {};
|
|
15
|
-
if (content.includes(flag.match))
|
|
16
|
-
flags[flag.name] = true;
|
|
17
|
-
else
|
|
18
|
-
flags[flag.name] = false;
|
|
19
|
-
const index = content.indexOf(flag.match);
|
|
20
|
-
if (index > 0)
|
|
21
|
-
content.splice(index, 1);
|
|
22
|
-
});
|
|
23
|
-
if (command.args)
|
|
24
|
-
for (const argument of command.args) {
|
|
25
|
-
const element = content.at(0) || null;
|
|
26
|
-
if (!element) {
|
|
27
|
-
if (typeof argument.default === 'function')
|
|
28
|
-
args[argument.name] = argument.default(message);
|
|
29
|
-
args[argument.name] = argument.default || null;
|
|
30
|
-
continue;
|
|
31
|
-
}
|
|
32
|
-
if (argument.type === 'option')
|
|
33
|
-
argument.match?.includes(element) ? (args[argument.name] = element) : (args[argument.name] = null);
|
|
34
|
-
if (argument.type === 'number')
|
|
35
|
-
args[argument.name] = parseInt(element);
|
|
36
|
-
if (argument.type === 'integer')
|
|
37
|
-
args[argument.name] = parseInt(element);
|
|
38
|
-
if (argument.type === 'boolean')
|
|
39
|
-
args[argument.name] = element === 'true' ? true : false;
|
|
40
|
-
if (argument.type === 'confirm')
|
|
41
|
-
args[argument.name] = element === 'yes' ? 'yes' : 'no';
|
|
42
|
-
if (argument.type === 'string')
|
|
43
|
-
args[argument.name] = element;
|
|
44
|
-
if (argument.type === 'channel') {
|
|
45
|
-
try {
|
|
46
|
-
const channel = await message.client.channels.fetch(element);
|
|
47
|
-
args[argument.name] = channel;
|
|
48
|
-
}
|
|
49
|
-
catch (e) {
|
|
50
|
-
args[argument.name] = null;
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
if (argument.type === 'guild') {
|
|
54
|
-
try {
|
|
55
|
-
const guild = await message.client.guilds.fetch(element);
|
|
56
|
-
args[argument.name] = guild;
|
|
57
|
-
}
|
|
58
|
-
catch (e) {
|
|
59
|
-
args[argument.name] = null;
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
if (argument.type === 'mentionable') {
|
|
63
|
-
(await Promise.all([message.guild?.roles, message.client.users, message.client.guilds, message.client.channels, message.guild?.members, message.channel.messages].map((req) => req
|
|
64
|
-
? req
|
|
65
|
-
.fetch(element)
|
|
66
|
-
.then((r) => r)
|
|
67
|
-
.catch(() => null)
|
|
68
|
-
: null))).map((mentionable) => {
|
|
69
|
-
if (!args)
|
|
70
|
-
args = {};
|
|
71
|
-
if (mentionable)
|
|
72
|
-
return (args[argument.name] = mentionable);
|
|
73
|
-
else
|
|
74
|
-
return (args[argument.name] = null);
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
if (argument.type === 'role') {
|
|
78
|
-
try {
|
|
79
|
-
const role = await message.guild?.roles.fetch(element);
|
|
80
|
-
args[argument.name] = role;
|
|
81
|
-
}
|
|
82
|
-
catch (e) {
|
|
83
|
-
args[argument.name] = null;
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
if (argument.type === 'user') {
|
|
87
|
-
try {
|
|
88
|
-
const user = await message.client.users.fetch(element);
|
|
89
|
-
args[argument.name] = user;
|
|
90
|
-
}
|
|
91
|
-
catch (e) {
|
|
92
|
-
args[argument.name] = null;
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
if (argument.type === 'member') {
|
|
96
|
-
try {
|
|
97
|
-
const member = await message.guild?.members.fetch(element);
|
|
98
|
-
args[argument.name] = member;
|
|
99
|
-
}
|
|
100
|
-
catch (e) {
|
|
101
|
-
args[argument.name] = null;
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
if (argument.type === 'message') {
|
|
105
|
-
try {
|
|
106
|
-
const msg = await message.channel?.messages.fetch(element);
|
|
107
|
-
args[argument.name] = msg;
|
|
108
|
-
}
|
|
109
|
-
catch (e) {
|
|
110
|
-
args[argument.name] = null;
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
if (argument.type === 'list') {
|
|
114
|
-
let separator = String(argument.separator) || ',';
|
|
115
|
-
if (separator.startsWith('/') && separator.endsWith('/'))
|
|
116
|
-
separator = separator.replace(/^\/|\/$/gim, '');
|
|
117
|
-
const items = content.join(' ').split(new RegExp(' *' + separator + ' *', 'gi'));
|
|
118
|
-
if (!argument.content)
|
|
119
|
-
args[argument.name] = items;
|
|
120
|
-
else {
|
|
121
|
-
const contents = argument.content.map((content) => content.toLowerCase()), itemList = [];
|
|
122
|
-
items.map((item) => (contents.includes(item.toLowerCase()) ? itemList.push(argument.content?.at(contents.indexOf(item.toLowerCase()))) : null));
|
|
123
|
-
args[argument.name] = itemList;
|
|
124
|
-
break;
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
if (argument.type === 'rest') {
|
|
128
|
-
args[argument.name] = content.join(separator);
|
|
129
|
-
break;
|
|
130
|
-
}
|
|
131
|
-
content.splice(0, 1);
|
|
132
|
-
}
|
|
133
|
-
if (!command.flags)
|
|
134
|
-
flags = null;
|
|
135
|
-
if (!command.args)
|
|
136
|
-
args = null;
|
|
137
|
-
return { args, flags };
|
|
138
|
-
}
|
|
139
|
-
exports.messageArguments = messageArguments;
|
|
140
|
-
async function interactionArguments(interaction, command) {
|
|
141
|
-
if (command.filetype === 'SlashCommand') {
|
|
142
|
-
const options = {};
|
|
143
|
-
let args = interaction?.options?._hoistedOptions, group = interaction?.options?._group, subcommand = interaction?.options?._subcommand;
|
|
144
|
-
if (interaction.options._hoistedOptions) {
|
|
145
|
-
for (const option of interaction.options._hoistedOptions) {
|
|
146
|
-
options[option.name] = option.member || option.channel || option.user || option.role || option.value;
|
|
147
|
-
}
|
|
148
|
-
args = options;
|
|
149
|
-
}
|
|
150
|
-
return { args, group, subcommand };
|
|
151
|
-
}
|
|
152
|
-
if (command.filetype === 'ContextCommand') {
|
|
153
|
-
if (command.type === 'user')
|
|
154
|
-
return await interaction.client.users.fetch(interaction.targetId);
|
|
155
|
-
if (command.type === 'message')
|
|
156
|
-
return await interaction.channel.messages.fetch(interaction.targetId);
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
exports.interactionArguments = interactionArguments;
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/** @format */
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
const discord_js_1 = require("discord.js");
|
|
5
|
-
class Cooldowns {
|
|
6
|
-
constructor(client, collections = []) {
|
|
7
|
-
this._client = client;
|
|
8
|
-
this.collections = {
|
|
9
|
-
commands: new discord_js_1.Collection(),
|
|
10
|
-
};
|
|
11
|
-
for (const collection of collections) {
|
|
12
|
-
this.collections[collection] = new discord_js_1.Collection();
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
add(collection, id, value) {
|
|
16
|
-
if (!this.collections[collection])
|
|
17
|
-
return `${collection} collection does not exist!`;
|
|
18
|
-
return this.collections[collection].set(id, value);
|
|
19
|
-
}
|
|
20
|
-
delete(collection, id) {
|
|
21
|
-
if (!this.collections[collection])
|
|
22
|
-
return `${collection} collection does not exist!`;
|
|
23
|
-
return this.collections[collection].delete(id);
|
|
24
|
-
}
|
|
25
|
-
has(id) {
|
|
26
|
-
const collected = {};
|
|
27
|
-
for (const [name, collection] of Object.entries(this.collections)) {
|
|
28
|
-
if (collection.has(id))
|
|
29
|
-
collected[name] = collection;
|
|
30
|
-
else
|
|
31
|
-
continue;
|
|
32
|
-
}
|
|
33
|
-
return collected;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
exports.default = Cooldowns;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/** @format */
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
class XernerxError {
|
|
5
|
-
name;
|
|
6
|
-
message;
|
|
7
|
-
stack;
|
|
8
|
-
constructor(message, error) {
|
|
9
|
-
this.name = 'XernerxError';
|
|
10
|
-
this.message = message || null;
|
|
11
|
-
this.stack = error || new Error().stack;
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
exports.default = XernerxError;
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/** @format */
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.XernerxIntents = void 0;
|
|
5
|
-
exports.XernerxIntents = {
|
|
6
|
-
Default: [
|
|
7
|
-
'Guilds',
|
|
8
|
-
'GuildModeration',
|
|
9
|
-
'GuildBans',
|
|
10
|
-
'GuildEmojisAndStickers',
|
|
11
|
-
'GuildIntegrations',
|
|
12
|
-
'GuildWebhooks',
|
|
13
|
-
'GuildInvites',
|
|
14
|
-
'GuildVoiceStates',
|
|
15
|
-
'GuildMessages',
|
|
16
|
-
'GuildMessageReactions',
|
|
17
|
-
'GuildMessageTyping',
|
|
18
|
-
'DirectMessages',
|
|
19
|
-
'DirectMessageReactions',
|
|
20
|
-
'DirectMessageTyping',
|
|
21
|
-
'GuildScheduledEvents',
|
|
22
|
-
'AutoModerationConfiguration',
|
|
23
|
-
'AutoModerationExecution',
|
|
24
|
-
],
|
|
25
|
-
All: [''],
|
|
26
|
-
};
|
|
27
|
-
exports.XernerxIntents.All = [...exports.XernerxIntents.Default, 'GuildMembers', 'GuildPresences', 'MessageContent'];
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/** @format */
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
const dumfunctions_1 = require("dumfunctions");
|
|
5
|
-
class XernerxLog {
|
|
6
|
-
constructor(client) {
|
|
7
|
-
this.client = client;
|
|
8
|
-
if (client == true || (typeof client.settings.log == 'boolean' && client.settings.log)) {
|
|
9
|
-
this.errorLog = true;
|
|
10
|
-
this.infoLog = true;
|
|
11
|
-
this.warnLog = true;
|
|
12
|
-
}
|
|
13
|
-
else {
|
|
14
|
-
this.errorLog = client.settings.log?.error;
|
|
15
|
-
this.infoLog = client.settings.log?.info;
|
|
16
|
-
this.warnLog = client.settings.log?.warn;
|
|
17
|
-
this.readyLog = client.settings.log?.ready;
|
|
18
|
-
this.tableLog = client.settings.log?.table;
|
|
19
|
-
}
|
|
20
|
-
this.time = () => String(new Date()).split(/ +/)[4];
|
|
21
|
-
this.ram = () => Math.round(process.memoryUsage().rss / 1000000);
|
|
22
|
-
this.shard = '';
|
|
23
|
-
process.on('message', (message) => {
|
|
24
|
-
if (message.type == 'xernerx')
|
|
25
|
-
this.shard = message?.data?.sharded ? `| ${message?.data?.shardId} |` : '';
|
|
26
|
-
});
|
|
27
|
-
this.base = (type, message) => `${type == 'info' ? `✔️ | ${this.purple('Xernerx')}` : type == `error` ? `❗ | ${this.red('Xernerx')}` : type == `update` ? `⬆️ | ${this.blue('Xernerx')}` : `⚠️ | ${this.yellow('Xernerx')}`} | ${this.cyan(this.time())} | ${this.cyan(this.ram())}mb | ${this.client.stats?.shardCount > 1 ? `${this.cyan(this.client.stats.shardId)} | ` : ''}${message}`;
|
|
28
|
-
}
|
|
29
|
-
info(message, force = false) {
|
|
30
|
-
return this.infoLog || force ? console.info(this.base('info', message)) : null;
|
|
31
|
-
}
|
|
32
|
-
warn(message) {
|
|
33
|
-
return this.warnLog ? console.warn(this.base('warn', message)) : null;
|
|
34
|
-
}
|
|
35
|
-
async update(version, url) {
|
|
36
|
-
const pkg = await fetch(url)
|
|
37
|
-
.then(async (res) => await res.json())
|
|
38
|
-
.catch(() => ({ version }));
|
|
39
|
-
if (version !== pkg.version)
|
|
40
|
-
console.info(this.base('update', `A new version for ${pkg.name} is available, you're using version ${this.cyan(version)}, new version is ${this.cyan(pkg.version)}, run ${dumfunctions_1.Style.log(`npm i ${pkg.name}@${pkg.version}`, {
|
|
41
|
-
color: dumfunctions_1.Style.BackgroundColor.Grey,
|
|
42
|
-
})} to update to the latest version.`));
|
|
43
|
-
}
|
|
44
|
-
error(message, error) {
|
|
45
|
-
return this.errorLog ? console.error(this.base('error', message), error) : null;
|
|
46
|
-
}
|
|
47
|
-
ready() {
|
|
48
|
-
if (typeof this.client == 'boolean')
|
|
49
|
-
return;
|
|
50
|
-
const client = this.client;
|
|
51
|
-
this.client.prependOnceListener('ready', async (synced) => {
|
|
52
|
-
this.info(`${dumfunctions_1.Style.log(synced.user.tag, { color: dumfunctions_1.Style.TextColor.Blue })} is now ${this.green('online')}, watching ${this.cyan(String(client.guilds.cache.size))} guild${client.guilds.cache.size > 1 ? 's' : ''}, using ${client.settings.local ? this.blue((await client.guilds.fetch(client.settings.local))?.name) : 'none'} as local guild.`, this.readyLog);
|
|
53
|
-
const files = [];
|
|
54
|
-
for (const [id, data] of client.commands.message) {
|
|
55
|
-
files.push(data);
|
|
56
|
-
id;
|
|
57
|
-
}
|
|
58
|
-
for (const [id, data] of client.commands.slash) {
|
|
59
|
-
files.push(data);
|
|
60
|
-
id;
|
|
61
|
-
}
|
|
62
|
-
for (const [id, data] of client.commands.context) {
|
|
63
|
-
files.push(data);
|
|
64
|
-
id;
|
|
65
|
-
}
|
|
66
|
-
for (const [id, data] of client.events) {
|
|
67
|
-
files.push(data);
|
|
68
|
-
id;
|
|
69
|
-
}
|
|
70
|
-
for (const [id, data] of client.inhibitors) {
|
|
71
|
-
files.push(data);
|
|
72
|
-
id;
|
|
73
|
-
}
|
|
74
|
-
if (this.tableLog) {
|
|
75
|
-
console.table(files, this.tableLog);
|
|
76
|
-
}
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
|
-
cyan(string) {
|
|
80
|
-
return dumfunctions_1.Style.log(String(string), { color: dumfunctions_1.Style.TextColor.Cyan });
|
|
81
|
-
}
|
|
82
|
-
blue(string) {
|
|
83
|
-
return dumfunctions_1.Style.log(String(string), { color: dumfunctions_1.Style.TextColor.Blue });
|
|
84
|
-
}
|
|
85
|
-
yellow(string) {
|
|
86
|
-
return dumfunctions_1.Style.log(String(string), { color: dumfunctions_1.Style.TextColor.Yellow });
|
|
87
|
-
}
|
|
88
|
-
purple(string) {
|
|
89
|
-
return dumfunctions_1.Style.log(String(string), { color: dumfunctions_1.Style.TextColor.Purple });
|
|
90
|
-
}
|
|
91
|
-
red(string) {
|
|
92
|
-
return dumfunctions_1.Style.log(String(string), { color: dumfunctions_1.Style.TextColor.Red });
|
|
93
|
-
}
|
|
94
|
-
green(string) {
|
|
95
|
-
return dumfunctions_1.Style.log(String(string), { color: dumfunctions_1.Style.TextColor.Green });
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
exports.default = XernerxLog;
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/** @format */
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
class XernerxText {
|
|
5
|
-
user(user) {
|
|
6
|
-
if (typeof user == 'object')
|
|
7
|
-
user = user.id;
|
|
8
|
-
return `<@${user}>`;
|
|
9
|
-
}
|
|
10
|
-
channel(channel) {
|
|
11
|
-
if (typeof channel == 'object')
|
|
12
|
-
channel = channel.id;
|
|
13
|
-
return `<#${channel}>`;
|
|
14
|
-
}
|
|
15
|
-
role(role) {
|
|
16
|
-
if (typeof role == 'object')
|
|
17
|
-
role = role.id;
|
|
18
|
-
return `<@&${role}>`;
|
|
19
|
-
}
|
|
20
|
-
emoji(emoji, animated = false) {
|
|
21
|
-
if (typeof emoji == 'object')
|
|
22
|
-
emoji = emoji.id;
|
|
23
|
-
return `<${animated ? 'a' : ''}:${emoji}>`;
|
|
24
|
-
}
|
|
25
|
-
member(member) {
|
|
26
|
-
if (typeof member == 'object')
|
|
27
|
-
member = member.id;
|
|
28
|
-
return `<@!${member}>`;
|
|
29
|
-
}
|
|
30
|
-
timestamp(timestamp = Date.now(), format = 'R') {
|
|
31
|
-
if (typeof timestamp == 'string')
|
|
32
|
-
timestamp = Number(timestamp);
|
|
33
|
-
if (isNaN(timestamp))
|
|
34
|
-
return 'Invalid Date';
|
|
35
|
-
return `<t:${timestamp}:${format}>`;
|
|
36
|
-
}
|
|
37
|
-
codeBlock(code, language) {
|
|
38
|
-
return `\`\`\`${language}
|
|
39
|
-
${code}
|
|
40
|
-
\`\`\``;
|
|
41
|
-
}
|
|
42
|
-
iCodeBlock(code) {
|
|
43
|
-
return `\`${code}\``;
|
|
44
|
-
}
|
|
45
|
-
bold(text) {
|
|
46
|
-
return `**${text}**`;
|
|
47
|
-
}
|
|
48
|
-
italic(text) {
|
|
49
|
-
return `*${text}*`;
|
|
50
|
-
}
|
|
51
|
-
underline(text) {
|
|
52
|
-
return `__${text}__`;
|
|
53
|
-
}
|
|
54
|
-
strike(text) {
|
|
55
|
-
return `~~${text}~~`;
|
|
56
|
-
}
|
|
57
|
-
spoiler(text) {
|
|
58
|
-
return `||${text}||`;
|
|
59
|
-
}
|
|
60
|
-
quote(text) {
|
|
61
|
-
return `> ${text}`;
|
|
62
|
-
}
|
|
63
|
-
blockQuote(text) {
|
|
64
|
-
return `>>> ${text}`;
|
|
65
|
-
}
|
|
66
|
-
hyperlink(text, url) {
|
|
67
|
-
return `[${text}](${url})`;
|
|
68
|
-
}
|
|
69
|
-
// public static HyperlinkWithTooltip(text: string, url: string, tooltip: string) {
|
|
70
|
-
// return `[${text}](${url} "${tooltip}")`;
|
|
71
|
-
// }
|
|
72
|
-
// public static HyperlinkWithTooltipAndImage(text: string, url: string, tooltip: string, imageUrl: string) {
|
|
73
|
-
// return `[${text}](${url} "${tooltip}":${imageUrl})`;
|
|
74
|
-
// }
|
|
75
|
-
// public static HyperlinkWithImage(text: string, url: string, imageUrl: string) {
|
|
76
|
-
// return `[${text}](${url}:${imageUrl})`;
|
|
77
|
-
// }
|
|
78
|
-
Progressbar(min, max, cur, options = {}) {
|
|
79
|
-
if (!options.fill)
|
|
80
|
-
options.fill = '█';
|
|
81
|
-
if (!options.fade)
|
|
82
|
-
options.fade = '▓▒';
|
|
83
|
-
if (!options.empty)
|
|
84
|
-
options.empty = '░';
|
|
85
|
-
const length = options.length || 20, percentage = cur / max, filledLength = Math.round(length * percentage), emptyLength = length - filledLength;
|
|
86
|
-
if (!options.percentage)
|
|
87
|
-
return '`' + options.fill.repeat(filledLength) + options.empty.repeat(emptyLength) + '`';
|
|
88
|
-
else
|
|
89
|
-
return '`' + options.fill.repeat(filledLength) + options.empty.repeat(emptyLength) + '` ' + `\`${percentage * 100}%\``;
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
exports.default = XernerxText;
|
package/dist/cjs/types/types.js
DELETED
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/** @format */
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
const discord_js_1 = require("discord.js");
|
|
5
|
-
const setPresence_js_1 = __importDefault(require("../functions/setPresence.js"));
|
|
6
|
-
const Util_js_1 = __importDefault(require("./Util.js"));
|
|
7
|
-
class ClientUtil extends Util_js_1.default {
|
|
8
|
-
constructor(client) {
|
|
9
|
-
super(client);
|
|
10
|
-
}
|
|
11
|
-
setPresence(options) {
|
|
12
|
-
return (0, setPresence_js_1.default)(this.client, options);
|
|
13
|
-
}
|
|
14
|
-
// @ts-ignore
|
|
15
|
-
resolveCooldown() { }
|
|
16
|
-
resolveCommand(options) {
|
|
17
|
-
const commands = [], collection = new discord_js_1.Collection();
|
|
18
|
-
if (options?.type == 'MessageCommand' || !options?.type)
|
|
19
|
-
commands.push(...this.client.commands.message);
|
|
20
|
-
if (options?.type == 'Interaction' || options?.type == 'SlashCommand' || !options?.type)
|
|
21
|
-
commands.push(...this.client.commands.slash);
|
|
22
|
-
if (options?.type == 'Interaction' || options?.type == 'ContextCommand' || !options?.type)
|
|
23
|
-
commands.push(...this.client.commands.context);
|
|
24
|
-
commands.map(([name, command]) => collection.set(name, command));
|
|
25
|
-
if (options?.name) {
|
|
26
|
-
return collection.get(options.name) || null;
|
|
27
|
-
}
|
|
28
|
-
else
|
|
29
|
-
return collection;
|
|
30
|
-
}
|
|
31
|
-
async resolveChannel(query) {
|
|
32
|
-
if (typeof query == 'object')
|
|
33
|
-
query = query.id;
|
|
34
|
-
try {
|
|
35
|
-
let channel = this.client.channels.cache.find((channel) => channel.name == query.toLowerCase() || channel.id == query.toLowerCase() ? channel : null) || null;
|
|
36
|
-
if (!channel)
|
|
37
|
-
channel = (await this.client.channels.fetch(query)) || null;
|
|
38
|
-
return channel;
|
|
39
|
-
}
|
|
40
|
-
catch {
|
|
41
|
-
return null;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
async resolveGuild(query) {
|
|
45
|
-
if (typeof query == 'object')
|
|
46
|
-
query = query.id;
|
|
47
|
-
try {
|
|
48
|
-
let guild = this.client.guilds.cache.find((guild) => guild.name.toLowerCase() == query.toLowerCase()) || null;
|
|
49
|
-
if (!guild)
|
|
50
|
-
guild = (await this.client.guilds.fetch(query)) || null;
|
|
51
|
-
return guild;
|
|
52
|
-
}
|
|
53
|
-
catch {
|
|
54
|
-
return null;
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
uptime(timestamp) {
|
|
58
|
-
if (!timestamp)
|
|
59
|
-
timestamp = this.client.uptime || 0;
|
|
60
|
-
let totalSeconds = timestamp / 1000;
|
|
61
|
-
let years = Math.floor(totalSeconds / 31536000);
|
|
62
|
-
totalSeconds %= 31536000;
|
|
63
|
-
let days = Math.floor(totalSeconds / 86400);
|
|
64
|
-
totalSeconds %= 86400;
|
|
65
|
-
let hours = Math.floor(totalSeconds / 3600);
|
|
66
|
-
totalSeconds %= 3600;
|
|
67
|
-
let minutes = Math.floor(totalSeconds / 60);
|
|
68
|
-
let seconds = Math.floor(totalSeconds % 60);
|
|
69
|
-
if (years >= 1)
|
|
70
|
-
return `${years}y ${days}d ${hours}h ${minutes}m`;
|
|
71
|
-
else if (days >= 1)
|
|
72
|
-
return `${days}d ${hours}h ${minutes}m`;
|
|
73
|
-
else if (hours >= 1)
|
|
74
|
-
return `${hours}h ${minutes}m`;
|
|
75
|
-
else if (minutes >= 1)
|
|
76
|
-
return `${minutes}m ${seconds}s`;
|
|
77
|
-
else
|
|
78
|
-
return `${seconds}s`;
|
|
79
|
-
}
|
|
80
|
-
commands() {
|
|
81
|
-
return [...this.client.commands.context.toJSON(), ...this.client.commands.slash.toJSON(), ...this.client.commands.message.toJSON()];
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
exports.default = ClientUtil;
|