xernerx 4.17.7 → 5.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/README.md +14 -67
- package/dist/main.cjs +63 -0
- package/dist/main.cjs.map +1 -0
- package/dist/main.d.cts +21 -0
- package/dist/main.d.ts +20 -46
- package/dist/main.js +23 -49
- package/dist/main.js.map +1 -0
- package/package.json +63 -47
- package/src/main.ts +26 -0
- package/dist/build/XernerxContextCommand.d.ts +0 -82
- package/dist/build/XernerxContextCommand.js +0 -125
- package/dist/build/XernerxEvent.d.ts +0 -21
- package/dist/build/XernerxEvent.js +0 -27
- package/dist/build/XernerxInhibitor.d.ts +0 -53
- package/dist/build/XernerxInhibitor.js +0 -27
- package/dist/build/XernerxMessageCommand.d.ts +0 -84
- package/dist/build/XernerxMessageCommand.js +0 -123
- package/dist/build/XernerxSlashCommand.d.ts +0 -104
- package/dist/build/XernerxSlashCommand.js +0 -182
- package/dist/client/XernerxClient.d.ts +0 -70
- package/dist/client/XernerxClient.js +0 -106
- package/dist/client/XernerxShardClient.d.ts +0 -21
- package/dist/client/XernerxShardClient.js +0 -67
- package/dist/functions/deploy.d.ts +0 -3
- package/dist/functions/deploy.js +0 -56
- package/dist/functions/load.d.ts +0 -4
- package/dist/functions/load.js +0 -34
- package/dist/functions/reload.d.ts +0 -3
- package/dist/functions/reload.js +0 -29
- package/dist/functions/setPresence.d.ts +0 -4
- package/dist/functions/setPresence.js +0 -22
- package/dist/functions/xernerxUser.d.ts +0 -4
- package/dist/functions/xernerxUser.js +0 -10
- package/dist/handlers/CommandHandler.d.ts +0 -16
- package/dist/handlers/CommandHandler.js +0 -326
- package/dist/handlers/EventHandler.d.ts +0 -9
- package/dist/handlers/EventHandler.js +0 -56
- package/dist/handlers/ExtensionHandler.d.ts +0 -9
- package/dist/handlers/ExtensionHandler.js +0 -29
- package/dist/handlers/Handler.d.ts +0 -31
- package/dist/handlers/Handler.js +0 -52
- package/dist/handlers/InhibitorHandler.d.ts +0 -9
- package/dist/handlers/InhibitorHandler.js +0 -33
- package/dist/handlers/IntegrationHandler.d.ts +0 -15
- package/dist/handlers/IntegrationHandler.js +0 -26
- package/dist/models/Arguments.d.ts +0 -12
- package/dist/models/Arguments.js +0 -139
- package/dist/models/Cooldowns.d.ts +0 -11
- package/dist/models/Cooldowns.js +0 -29
- package/dist/tools/XernerxError.d.ts +0 -7
- package/dist/tools/XernerxError.js +0 -11
- package/dist/tools/XernerxIntents.d.ts +0 -6
- package/dist/tools/XernerxIntents.js +0 -26
- package/dist/tools/XernerxLog.d.ts +0 -31
- package/dist/tools/XernerxLog.js +0 -148
- package/dist/tools/XernerxText.d.ts +0 -31
- package/dist/tools/XernerxText.js +0 -84
- package/dist/types/extenders.d.ts +0 -84
- package/dist/types/extenders.js +0 -2
- package/dist/types/interfaces.d.ts +0 -263
- package/dist/types/interfaces.js +0 -2
- package/dist/types/types.d.ts +0 -111
- package/dist/types/types.js +0 -2
- package/dist/utils/ClientUtil.d.ts +0 -22
- package/dist/utils/ClientUtil.js +0 -102
- package/dist/utils/InteractionUtil.d.ts +0 -25
- package/dist/utils/InteractionUtil.js +0 -154
- package/dist/utils/MessageUtil.d.ts +0 -26
- package/dist/utils/MessageUtil.js +0 -168
- package/dist/utils/Util.d.ts +0 -12
- package/dist/utils/Util.js +0 -11
- package/dist/validators/commandValidation.d.ts +0 -10
- package/dist/validators/commandValidation.js +0 -167
- package/dist/validators/inhibitorValidations.d.ts +0 -28
- package/dist/validators/inhibitorValidations.js +0 -44
package/dist/models/Arguments.js
DELETED
|
@@ -1,139 +0,0 @@
|
|
|
1
|
-
/** @format */
|
|
2
|
-
export async function messageArguments(message, command, prefix) {
|
|
3
|
-
const separator = command.separator || ' ',
|
|
4
|
-
content = message.content
|
|
5
|
-
.replace(new RegExp(`${prefix} +?`), '')
|
|
6
|
-
.split(separator)
|
|
7
|
-
.slice(1);
|
|
8
|
-
let args = {},
|
|
9
|
-
flags = {};
|
|
10
|
-
if (command.flags)
|
|
11
|
-
command.flags.map((flag) => {
|
|
12
|
-
if (!flags) flags = {};
|
|
13
|
-
if (content.includes(flag.match)) flags[flag.name] = true;
|
|
14
|
-
else flags[flag.name] = false;
|
|
15
|
-
const index = content.indexOf(flag.match);
|
|
16
|
-
if (index > 0) content.splice(index, 1);
|
|
17
|
-
});
|
|
18
|
-
if (command.args)
|
|
19
|
-
for (const argument of command.args) {
|
|
20
|
-
const element = content.at(0) || null;
|
|
21
|
-
if (!element) {
|
|
22
|
-
if (typeof argument.default === 'function') args[argument.name] = argument.default(message);
|
|
23
|
-
args[argument.name] = argument.default || null;
|
|
24
|
-
continue;
|
|
25
|
-
}
|
|
26
|
-
if (argument.type === 'option') argument.match?.includes(element) ? (args[argument.name] = element) : (args[argument.name] = null);
|
|
27
|
-
if (argument.type === 'number') args[argument.name] = parseInt(element);
|
|
28
|
-
if (argument.type === 'integer') args[argument.name] = parseInt(element);
|
|
29
|
-
if (argument.type === 'boolean') args[argument.name] = element === 'true' ? true : false;
|
|
30
|
-
if (argument.type === 'confirm') args[argument.name] = element === 'yes' ? 'yes' : 'no';
|
|
31
|
-
if (argument.type === 'string') args[argument.name] = element;
|
|
32
|
-
if (argument.type === 'channel') {
|
|
33
|
-
try {
|
|
34
|
-
const channel = await message.client.channels.fetch(element);
|
|
35
|
-
args[argument.name] = channel;
|
|
36
|
-
} catch (e) {
|
|
37
|
-
args[argument.name] = null;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
if (argument.type === 'guild') {
|
|
41
|
-
try {
|
|
42
|
-
const guild = await message.client.guilds.fetch(element);
|
|
43
|
-
args[argument.name] = guild;
|
|
44
|
-
} catch (e) {
|
|
45
|
-
args[argument.name] = null;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
if (argument.type === 'mentionable') {
|
|
49
|
-
(
|
|
50
|
-
await Promise.all(
|
|
51
|
-
[message.guild?.roles, message.client.users, message.client.guilds, message.client.channels, message.guild?.members, message.channel.messages].map((req) =>
|
|
52
|
-
req
|
|
53
|
-
? req
|
|
54
|
-
.fetch(element)
|
|
55
|
-
.then((r) => r)
|
|
56
|
-
.catch(() => null)
|
|
57
|
-
: null
|
|
58
|
-
)
|
|
59
|
-
)
|
|
60
|
-
).map((mentionable) => {
|
|
61
|
-
if (!args) args = {};
|
|
62
|
-
if (mentionable) return (args[argument.name] = mentionable);
|
|
63
|
-
else return (args[argument.name] = null);
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
if (argument.type === 'role') {
|
|
67
|
-
try {
|
|
68
|
-
const role = await message.guild?.roles.fetch(element);
|
|
69
|
-
args[argument.name] = role;
|
|
70
|
-
} catch (e) {
|
|
71
|
-
args[argument.name] = null;
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
if (argument.type === 'user') {
|
|
75
|
-
try {
|
|
76
|
-
const user = await message.client.users.fetch(element);
|
|
77
|
-
args[argument.name] = user;
|
|
78
|
-
} catch (e) {
|
|
79
|
-
args[argument.name] = null;
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
if (argument.type === 'member') {
|
|
83
|
-
try {
|
|
84
|
-
const member = await message.guild?.members.fetch(element);
|
|
85
|
-
args[argument.name] = member;
|
|
86
|
-
} catch (e) {
|
|
87
|
-
args[argument.name] = null;
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
if (argument.type === 'message') {
|
|
91
|
-
try {
|
|
92
|
-
const msg = await message.channel?.messages.fetch(element);
|
|
93
|
-
args[argument.name] = msg;
|
|
94
|
-
} catch (e) {
|
|
95
|
-
args[argument.name] = null;
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
if (argument.type === 'list') {
|
|
99
|
-
let separator = String(argument.separator) || ',';
|
|
100
|
-
if (separator.startsWith('/') && separator.endsWith('/')) separator = separator.replace(/^\/|\/$/gim, '');
|
|
101
|
-
const items = content.join(' ').split(new RegExp(' *' + separator + ' *', 'gi'));
|
|
102
|
-
if (!argument.content) args[argument.name] = items;
|
|
103
|
-
else {
|
|
104
|
-
const contents = argument.content.map((content) => content.toLowerCase()),
|
|
105
|
-
itemList = [];
|
|
106
|
-
items.map((item) => (contents.includes(item.toLowerCase()) ? itemList.push(argument.content?.at(contents.indexOf(item.toLowerCase()))) : null));
|
|
107
|
-
args[argument.name] = itemList;
|
|
108
|
-
break;
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
if (argument.type === 'rest') {
|
|
112
|
-
args[argument.name] = content.join(separator);
|
|
113
|
-
break;
|
|
114
|
-
}
|
|
115
|
-
content.splice(0, 1);
|
|
116
|
-
}
|
|
117
|
-
if (!command.flags) flags = null;
|
|
118
|
-
if (!command.args) args = null;
|
|
119
|
-
return { args, flags };
|
|
120
|
-
}
|
|
121
|
-
export async function interactionArguments(interaction, command) {
|
|
122
|
-
if (command.filetype === 'SlashCommand') {
|
|
123
|
-
const options = {};
|
|
124
|
-
let args = interaction?.options?._hoistedOptions,
|
|
125
|
-
group = interaction?.options?._group,
|
|
126
|
-
subcommand = interaction?.options?._subcommand;
|
|
127
|
-
if (interaction.options._hoistedOptions) {
|
|
128
|
-
for (const option of interaction.options._hoistedOptions) {
|
|
129
|
-
options[option.name] = option.member || option.channel || option.user || option.role || option.value;
|
|
130
|
-
}
|
|
131
|
-
args = options;
|
|
132
|
-
}
|
|
133
|
-
return { args, group, subcommand };
|
|
134
|
-
}
|
|
135
|
-
if (command.filetype === 'ContextCommand') {
|
|
136
|
-
if (command.type === 'user') return await interaction.client.users.fetch(interaction.targetId);
|
|
137
|
-
if (command.type === 'message') return await interaction.channel.messages.fetch(interaction.targetId);
|
|
138
|
-
}
|
|
139
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/** @format */
|
|
2
|
-
import { Collection } from 'discord.js';
|
|
3
|
-
import XernerxClient from '../client/XernerxClient.js';
|
|
4
|
-
export default class Cooldowns {
|
|
5
|
-
private readonly _client;
|
|
6
|
-
readonly collections: Record<string, Collection<string, unknown>>;
|
|
7
|
-
constructor(client: XernerxClient, collections?: Array<string>);
|
|
8
|
-
add(collection: keyof typeof this.collections, id: string, value: unknown): string | Collection<string, unknown>;
|
|
9
|
-
delete(collection: keyof typeof this.collections, id: string): string | boolean;
|
|
10
|
-
has(id: string): Record<string, Collection<string, unknown>>;
|
|
11
|
-
}
|
package/dist/models/Cooldowns.js
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
/** @format */
|
|
2
|
-
import { Collection } from 'discord.js';
|
|
3
|
-
export default class Cooldowns {
|
|
4
|
-
constructor(client, collections = []) {
|
|
5
|
-
this._client = client;
|
|
6
|
-
this.collections = {
|
|
7
|
-
commands: new Collection(),
|
|
8
|
-
};
|
|
9
|
-
for (const collection of collections) {
|
|
10
|
-
this.collections[collection] = new Collection();
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
add(collection, id, value) {
|
|
14
|
-
if (!this.collections[collection]) return `${collection} collection does not exist!`;
|
|
15
|
-
return this.collections[collection].set(id, value);
|
|
16
|
-
}
|
|
17
|
-
delete(collection, id) {
|
|
18
|
-
if (!this.collections[collection]) return `${collection} collection does not exist!`;
|
|
19
|
-
return this.collections[collection].delete(id);
|
|
20
|
-
}
|
|
21
|
-
has(id) {
|
|
22
|
-
const collected = {};
|
|
23
|
-
for (const [name, collection] of Object.entries(this.collections)) {
|
|
24
|
-
if (collection.has(id)) collected[name] = collection;
|
|
25
|
-
else continue;
|
|
26
|
-
}
|
|
27
|
-
return collected;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/** @format */
|
|
2
|
-
import { GatewayIntentBits } from 'discord.js';
|
|
3
|
-
export const XernerxIntents = {
|
|
4
|
-
Default: [
|
|
5
|
-
GatewayIntentBits.Guilds,
|
|
6
|
-
GatewayIntentBits.GuildModeration,
|
|
7
|
-
GatewayIntentBits.GuildBans,
|
|
8
|
-
GatewayIntentBits.GuildModeration,
|
|
9
|
-
GatewayIntentBits.GuildEmojisAndStickers,
|
|
10
|
-
GatewayIntentBits.GuildIntegrations,
|
|
11
|
-
GatewayIntentBits.GuildWebhooks,
|
|
12
|
-
GatewayIntentBits.GuildInvites,
|
|
13
|
-
GatewayIntentBits.GuildVoiceStates,
|
|
14
|
-
GatewayIntentBits.GuildMessages,
|
|
15
|
-
GatewayIntentBits.GuildMessageReactions,
|
|
16
|
-
GatewayIntentBits.GuildMessageTyping,
|
|
17
|
-
GatewayIntentBits.DirectMessages,
|
|
18
|
-
GatewayIntentBits.DirectMessageReactions,
|
|
19
|
-
GatewayIntentBits.DirectMessageTyping,
|
|
20
|
-
GatewayIntentBits.GuildScheduledEvents,
|
|
21
|
-
GatewayIntentBits.AutoModerationConfiguration,
|
|
22
|
-
GatewayIntentBits.AutoModerationExecution,
|
|
23
|
-
],
|
|
24
|
-
All: [GatewayIntentBits.GuildMembers, GatewayIntentBits.GuildPresences, GatewayIntentBits.MessageContent],
|
|
25
|
-
};
|
|
26
|
-
XernerxIntents.All.push(...XernerxIntents.Default);
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
/** @format */
|
|
2
|
-
import XernerxError from './XernerxError.js';
|
|
3
|
-
import XernerxClient from '../client/XernerxClient.js';
|
|
4
|
-
import { XernerxClientType } from '../types/extenders.js';
|
|
5
|
-
export default class XernerxLog {
|
|
6
|
-
private readonly client;
|
|
7
|
-
private readonly errorLog;
|
|
8
|
-
private readonly infoLog;
|
|
9
|
-
private readonly warnLog;
|
|
10
|
-
private readonly readyLog;
|
|
11
|
-
private readonly tableLog;
|
|
12
|
-
private readonly format;
|
|
13
|
-
private readonly time;
|
|
14
|
-
private readonly ram;
|
|
15
|
-
private shard;
|
|
16
|
-
private readonly base;
|
|
17
|
-
constructor(client: XernerxClient | XernerxClientType | true);
|
|
18
|
-
info(message: string, force?: boolean): void | null;
|
|
19
|
-
warn(message: string): void | null;
|
|
20
|
-
debug(message: string): void;
|
|
21
|
-
update(version: string, url: string): Promise<void>;
|
|
22
|
-
error(message: string, error?: XernerxError | unknown): void | null;
|
|
23
|
-
ready(): void;
|
|
24
|
-
private cyan;
|
|
25
|
-
private blue;
|
|
26
|
-
private yellow;
|
|
27
|
-
private purple;
|
|
28
|
-
private red;
|
|
29
|
-
private green;
|
|
30
|
-
private turquoise;
|
|
31
|
-
}
|
package/dist/tools/XernerxLog.js
DELETED
|
@@ -1,148 +0,0 @@
|
|
|
1
|
-
/** @format */
|
|
2
|
-
import { Style } from 'dumfunctions';
|
|
3
|
-
import * as fs from 'fs';
|
|
4
|
-
import Discord from 'discord.js';
|
|
5
|
-
import { version } from '../main.js';
|
|
6
|
-
const pkg = JSON.parse(fs.readFileSync('./package.json', 'utf-8'));
|
|
7
|
-
let i = 0;
|
|
8
|
-
export default class XernerxLog {
|
|
9
|
-
constructor(client) {
|
|
10
|
-
this.client = client;
|
|
11
|
-
if (client == true || (typeof client.settings.log == 'boolean' && client.settings.log)) {
|
|
12
|
-
this.errorLog = true;
|
|
13
|
-
this.infoLog = true;
|
|
14
|
-
this.warnLog = true;
|
|
15
|
-
this.format = ['ram', 'time'];
|
|
16
|
-
} else {
|
|
17
|
-
this.errorLog = client.settings.log?.error;
|
|
18
|
-
this.infoLog = client.settings.log?.info;
|
|
19
|
-
this.warnLog = client.settings.log?.warn;
|
|
20
|
-
this.readyLog = client.settings.log?.ready;
|
|
21
|
-
this.tableLog = client.settings.log?.table;
|
|
22
|
-
this.format = client.settings.log?.format || ['ram', 'time'];
|
|
23
|
-
}
|
|
24
|
-
const format = {
|
|
25
|
-
name: this.blue(pkg.name),
|
|
26
|
-
node: this.green(process.version),
|
|
27
|
-
xernerx: this.cyan(version),
|
|
28
|
-
discordjs: this.cyan(Discord.version),
|
|
29
|
-
platform: this.green(process.platform),
|
|
30
|
-
time: () => this.cyan(new Date().toLocaleTimeString()),
|
|
31
|
-
date: () => this.cyan(new Date().toLocaleDateString()),
|
|
32
|
-
ram: () => `${this.cyan(Math.round(process.memoryUsage().rss / 1000000))}mb`,
|
|
33
|
-
version: this.cyan(pkg.version),
|
|
34
|
-
author: this.blue(pkg.author),
|
|
35
|
-
shard: this.cyan(''),
|
|
36
|
-
index: () => {
|
|
37
|
-
i++;
|
|
38
|
-
return i;
|
|
39
|
-
},
|
|
40
|
-
};
|
|
41
|
-
process.on('message', (message) => {
|
|
42
|
-
if (message.type == 'xernerx') format.shard = message?.data?.sharded ? `| ${message?.data?.shardId} |` : '';
|
|
43
|
-
});
|
|
44
|
-
this.base = (type, message) =>
|
|
45
|
-
`${
|
|
46
|
-
type == 'info'
|
|
47
|
-
? `✔️ | ${this.purple('Xernerx')}`
|
|
48
|
-
: type == `error`
|
|
49
|
-
? `❗ | ${this.red('Xernerx')}`
|
|
50
|
-
: type == `update`
|
|
51
|
-
? `⬆️ | ${this.blue('Xernerx')}`
|
|
52
|
-
: type == `debug`
|
|
53
|
-
? `🐛 | ${this.turquoise('Xernerx')}`
|
|
54
|
-
: `⚠️ | ${this.yellow('Xernerx')}`
|
|
55
|
-
} | ${this.format
|
|
56
|
-
?.map((c) => (typeof format[c] == 'function' ? format[c]() : format[c]) || null)
|
|
57
|
-
.filter((x) => x)
|
|
58
|
-
.join(' | ')} | ${message}`;
|
|
59
|
-
}
|
|
60
|
-
info(message, force = false) {
|
|
61
|
-
return this.infoLog || force ? console.info(this.base('info', message)) : null;
|
|
62
|
-
}
|
|
63
|
-
warn(message) {
|
|
64
|
-
return this.warnLog ? console.warn(this.base('warn', message)) : null;
|
|
65
|
-
}
|
|
66
|
-
debug(message) {
|
|
67
|
-
return console.debug(this.base('debug', message));
|
|
68
|
-
}
|
|
69
|
-
async update(version, url) {
|
|
70
|
-
try {
|
|
71
|
-
const pkg = await fetch(url)
|
|
72
|
-
.then(async (res) => await res.json())
|
|
73
|
-
.catch(() => ({ version }));
|
|
74
|
-
if (version !== pkg.version)
|
|
75
|
-
console.info(
|
|
76
|
-
this.base(
|
|
77
|
-
'update',
|
|
78
|
-
`A new version for ${pkg.name} is available, you're using version ${this.cyan(version)}, new version is ${this.cyan(pkg.version)}, run ${Style.log(`npm i ${pkg.name}@${pkg.version}`, {
|
|
79
|
-
color: Style.BackgroundColor.Grey,
|
|
80
|
-
})} to update to the latest version.`
|
|
81
|
-
)
|
|
82
|
-
);
|
|
83
|
-
} catch (error) {
|
|
84
|
-
console.warn(this.base('error', `An error occured while trying to check for a new version for ${pkg.name}, please try again later.`));
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
error(message, error) {
|
|
88
|
-
return this.errorLog ? console.error(this.base('error', message), error || '') : null;
|
|
89
|
-
}
|
|
90
|
-
ready() {
|
|
91
|
-
if (typeof this.client == 'boolean') return;
|
|
92
|
-
const client = this.client;
|
|
93
|
-
// @ts-ignore
|
|
94
|
-
this.client.prependOnceListener('ready', async (synced) => {
|
|
95
|
-
this.info(
|
|
96
|
-
`${Style.log(synced.user.tag, { color: Style.TextColor.Blue })} is now ${this.green('online')}, watching ${this.cyan(String(client.guilds.cache.size))} guild${
|
|
97
|
-
client.guilds.cache.size > 1 ? 's' : ''
|
|
98
|
-
}, using ${client.settings.local ? this.blue((await client.guilds.fetch(client.settings.local))?.name) : 'none'} as local guild.`,
|
|
99
|
-
this.readyLog
|
|
100
|
-
);
|
|
101
|
-
const files = [];
|
|
102
|
-
for (const [id, data] of client.commands.message) {
|
|
103
|
-
files.push(data);
|
|
104
|
-
id;
|
|
105
|
-
}
|
|
106
|
-
for (const [id, data] of client.commands.slash) {
|
|
107
|
-
files.push(data);
|
|
108
|
-
id;
|
|
109
|
-
}
|
|
110
|
-
for (const [id, data] of client.commands.context) {
|
|
111
|
-
files.push(data);
|
|
112
|
-
id;
|
|
113
|
-
}
|
|
114
|
-
for (const [id, data] of client.events) {
|
|
115
|
-
files.push(data);
|
|
116
|
-
id;
|
|
117
|
-
}
|
|
118
|
-
for (const [id, data] of client.inhibitors) {
|
|
119
|
-
files.push(data);
|
|
120
|
-
id;
|
|
121
|
-
}
|
|
122
|
-
if (this.tableLog) {
|
|
123
|
-
console.table(files, this.tableLog);
|
|
124
|
-
}
|
|
125
|
-
});
|
|
126
|
-
}
|
|
127
|
-
cyan(string) {
|
|
128
|
-
return Style.log(String(string), { color: Style.TextColor.Cyan });
|
|
129
|
-
}
|
|
130
|
-
blue(string) {
|
|
131
|
-
return Style.log(String(string), { color: Style.TextColor.Blue });
|
|
132
|
-
}
|
|
133
|
-
yellow(string) {
|
|
134
|
-
return Style.log(String(string), { color: Style.TextColor.Yellow });
|
|
135
|
-
}
|
|
136
|
-
purple(string) {
|
|
137
|
-
return Style.log(String(string), { color: Style.TextColor.Purple });
|
|
138
|
-
}
|
|
139
|
-
red(string) {
|
|
140
|
-
return Style.log(String(string), { color: Style.TextColor.Red });
|
|
141
|
-
}
|
|
142
|
-
green(string) {
|
|
143
|
-
return Style.log(String(string), { color: Style.TextColor.Green });
|
|
144
|
-
}
|
|
145
|
-
turquoise(string) {
|
|
146
|
-
return Style.log(String(string), { color: Style.TextColor.Turquoise });
|
|
147
|
-
}
|
|
148
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
/** @format */
|
|
2
|
-
import { Emoji, Role } from 'discord.js';
|
|
3
|
-
import { XernerxGuildChannel, XernerxMember, XernerxUser } from '../types/extenders.js';
|
|
4
|
-
export default class XernerxText {
|
|
5
|
-
user(user: string | XernerxUser): string;
|
|
6
|
-
channel(channel: string | XernerxGuildChannel): string;
|
|
7
|
-
role(role: string | Role): string;
|
|
8
|
-
emoji(emoji: string | Emoji, animated?: boolean): string;
|
|
9
|
-
member(member: string | XernerxMember): string;
|
|
10
|
-
command(id: string, name: string): string | null;
|
|
11
|
-
timestamp(timestamp?: number | Date, format?: 't' | 'T' | 'd' | 'D' | 'f' | 'F' | 'R'): string;
|
|
12
|
-
codeBlock(code: string, language: string): string;
|
|
13
|
-
iCodeBlock(code: string): string;
|
|
14
|
-
bold(text: string): string;
|
|
15
|
-
italic(text: string): string;
|
|
16
|
-
underline(text: string): string;
|
|
17
|
-
strike(text: string): string;
|
|
18
|
-
spoiler(text: string): string;
|
|
19
|
-
quote(text: string): string;
|
|
20
|
-
blockQuote(text: string): string;
|
|
21
|
-
hyperlink(text: string, url: string): string;
|
|
22
|
-
Progressbar(min: number, max: number, cur: number, options?: ProgressBarOptions): string;
|
|
23
|
-
}
|
|
24
|
-
interface ProgressBarOptions {
|
|
25
|
-
fill?: string;
|
|
26
|
-
fade?: string;
|
|
27
|
-
empty?: string;
|
|
28
|
-
percentage?: boolean;
|
|
29
|
-
length?: number;
|
|
30
|
-
}
|
|
31
|
-
export {};
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
/** @format */
|
|
2
|
-
export default class XernerxText {
|
|
3
|
-
user(user) {
|
|
4
|
-
if (typeof user == 'object') user = user.id;
|
|
5
|
-
return `<@${user}>`;
|
|
6
|
-
}
|
|
7
|
-
channel(channel) {
|
|
8
|
-
if (typeof channel == 'object') channel = channel.id;
|
|
9
|
-
return `<#${channel}>`;
|
|
10
|
-
}
|
|
11
|
-
role(role) {
|
|
12
|
-
if (typeof role == 'object') role = role.id;
|
|
13
|
-
return `<@&${role}>`;
|
|
14
|
-
}
|
|
15
|
-
emoji(emoji, animated = false) {
|
|
16
|
-
if (typeof emoji == 'object') emoji = emoji.id;
|
|
17
|
-
return `<${animated ? 'a' : ''}:${emoji}>`;
|
|
18
|
-
}
|
|
19
|
-
member(member) {
|
|
20
|
-
if (typeof member == 'object') member = member.id;
|
|
21
|
-
return `<@!${member}>`;
|
|
22
|
-
}
|
|
23
|
-
command(id, name) {
|
|
24
|
-
if (typeof id !== 'string') return null;
|
|
25
|
-
return `</${name}:${id}>`;
|
|
26
|
-
}
|
|
27
|
-
timestamp(timestamp = Date.now(), format = 'R') {
|
|
28
|
-
if (typeof timestamp == 'string') timestamp = Number(timestamp);
|
|
29
|
-
if (isNaN(timestamp)) return 'Invalid Date';
|
|
30
|
-
return `<t:${timestamp}:${format}>`;
|
|
31
|
-
}
|
|
32
|
-
codeBlock(code, language) {
|
|
33
|
-
return `\`\`\`${language}
|
|
34
|
-
${code}
|
|
35
|
-
\`\`\``;
|
|
36
|
-
}
|
|
37
|
-
iCodeBlock(code) {
|
|
38
|
-
return `\`${code}\``;
|
|
39
|
-
}
|
|
40
|
-
bold(text) {
|
|
41
|
-
return `**${text}**`;
|
|
42
|
-
}
|
|
43
|
-
italic(text) {
|
|
44
|
-
return `*${text}*`;
|
|
45
|
-
}
|
|
46
|
-
underline(text) {
|
|
47
|
-
return `__${text}__`;
|
|
48
|
-
}
|
|
49
|
-
strike(text) {
|
|
50
|
-
return `~~${text}~~`;
|
|
51
|
-
}
|
|
52
|
-
spoiler(text) {
|
|
53
|
-
return `||${text}||`;
|
|
54
|
-
}
|
|
55
|
-
quote(text) {
|
|
56
|
-
return `> ${text}`;
|
|
57
|
-
}
|
|
58
|
-
blockQuote(text) {
|
|
59
|
-
return `>>> ${text}`;
|
|
60
|
-
}
|
|
61
|
-
hyperlink(text, url) {
|
|
62
|
-
return `[${text}](${url})`;
|
|
63
|
-
}
|
|
64
|
-
// public static HyperlinkWithTooltip(text: string, url: string, tooltip: string) {
|
|
65
|
-
// return `[${text}](${url} "${tooltip}")`;
|
|
66
|
-
// }
|
|
67
|
-
// public static HyperlinkWithTooltipAndImage(text: string, url: string, tooltip: string, imageUrl: string) {
|
|
68
|
-
// return `[${text}](${url} "${tooltip}":${imageUrl})`;
|
|
69
|
-
// }
|
|
70
|
-
// public static HyperlinkWithImage(text: string, url: string, imageUrl: string) {
|
|
71
|
-
// return `[${text}](${url}:${imageUrl})`;
|
|
72
|
-
// }
|
|
73
|
-
Progressbar(min, max, cur, options = {}) {
|
|
74
|
-
if (!options.fill) options.fill = '█';
|
|
75
|
-
if (!options.fade) options.fade = '▓▒';
|
|
76
|
-
if (!options.empty) options.empty = '░';
|
|
77
|
-
const length = options.length || 20,
|
|
78
|
-
percentage = cur / max,
|
|
79
|
-
filledLength = Math.round(length * percentage),
|
|
80
|
-
emptyLength = length - filledLength;
|
|
81
|
-
if (!options.percentage) return '`' + options.fill.repeat(filledLength) + options.empty.repeat(emptyLength) + '`';
|
|
82
|
-
else return '`' + options.fill.repeat(filledLength) + options.empty.repeat(emptyLength) + '` ' + `\`${percentage * 100}%\``;
|
|
83
|
-
}
|
|
84
|
-
}
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
/** @format */
|
|
2
|
-
import {
|
|
3
|
-
ChatInputCommandInteraction,
|
|
4
|
-
Collection,
|
|
5
|
-
DMChannel,
|
|
6
|
-
Guild,
|
|
7
|
-
GuildChannel,
|
|
8
|
-
GuildMember,
|
|
9
|
-
Message,
|
|
10
|
-
MessageContextMenuCommandInteraction,
|
|
11
|
-
User,
|
|
12
|
-
UserContextMenuCommandInteraction,
|
|
13
|
-
ClientEvents,
|
|
14
|
-
} from 'discord.js';
|
|
15
|
-
import InteractionUtil from '../utils/InteractionUtil.js';
|
|
16
|
-
import MessageUtil from '../utils/MessageUtil.js';
|
|
17
|
-
import { ModuleOptions, XernerxCache, XernerxCommands } from '../types/interfaces.js';
|
|
18
|
-
import XernerxEvent from '../build/XernerxEvent.js';
|
|
19
|
-
import XernerxInhibitor from '../build/XernerxInhibitor.js';
|
|
20
|
-
import XernerxClient from '../client/XernerxClient.js';
|
|
21
|
-
import ClientUtil from '../utils/ClientUtil.js';
|
|
22
|
-
import { XernerxContextCommand, XernerxMessageCommand, XernerxSlashCommand } from '../main.js';
|
|
23
|
-
import XernerxError from '../tools/XernerxError.js';
|
|
24
|
-
export interface XernerxUser extends User {
|
|
25
|
-
owner: boolean;
|
|
26
|
-
voted: boolean | null;
|
|
27
|
-
}
|
|
28
|
-
export interface XernerxMember extends GuildMember {
|
|
29
|
-
username: string;
|
|
30
|
-
}
|
|
31
|
-
export interface XernerxGuild extends Guild {}
|
|
32
|
-
export interface XernerxGuildChannel extends GuildChannel {}
|
|
33
|
-
export interface XernerxDMChannel extends DMChannel {}
|
|
34
|
-
interface XernerxCommand {}
|
|
35
|
-
export interface XernerxMessage extends Message, XernerxCommand {
|
|
36
|
-
user: XernerxUser;
|
|
37
|
-
util: MessageUtil;
|
|
38
|
-
}
|
|
39
|
-
export interface XernerxSlashInteraction extends ChatInputCommandInteraction, XernerxCommand {
|
|
40
|
-
user: XernerxUser;
|
|
41
|
-
util: InteractionUtil;
|
|
42
|
-
}
|
|
43
|
-
export interface XernerxUserContextInteraction extends UserContextMenuCommandInteraction, XernerxCommand {
|
|
44
|
-
user: XernerxUser;
|
|
45
|
-
util: InteractionUtil;
|
|
46
|
-
}
|
|
47
|
-
export interface XernerxMessageContextInteraction extends MessageContextMenuCommandInteraction, XernerxCommand {
|
|
48
|
-
user: XernerxUser;
|
|
49
|
-
util: InteractionUtil;
|
|
50
|
-
}
|
|
51
|
-
export interface XernerxClientType extends XernerxClient {
|
|
52
|
-
commands: XernerxCommands;
|
|
53
|
-
events: Collection<string, XernerxEvent<keyof XernerxClientEvents>>;
|
|
54
|
-
inhibitors: Collection<string, XernerxInhibitor>;
|
|
55
|
-
modules: ModuleOptions;
|
|
56
|
-
util: ClientUtil;
|
|
57
|
-
stats: {
|
|
58
|
-
guildCount: number;
|
|
59
|
-
userCount: number;
|
|
60
|
-
shardId: number;
|
|
61
|
-
shardCount: number;
|
|
62
|
-
};
|
|
63
|
-
cooldown: {
|
|
64
|
-
default: number;
|
|
65
|
-
cache: number;
|
|
66
|
-
collections: Array<string>;
|
|
67
|
-
};
|
|
68
|
-
cache: XernerxCache;
|
|
69
|
-
connect: () => Promise<string>;
|
|
70
|
-
}
|
|
71
|
-
interface CommandBlockInfo {
|
|
72
|
-
reason: string;
|
|
73
|
-
message: string;
|
|
74
|
-
required: Array<string> | string;
|
|
75
|
-
missing: Array<string> | string;
|
|
76
|
-
}
|
|
77
|
-
export interface XernerxClientEvents extends ClientEvents {
|
|
78
|
-
commandBlock: [event: XernerxMessage | XernerxSlashInteraction, info: CommandBlockInfo, command: XernerxSlashCommand | XernerxMessageCommand | XernerxContextCommand];
|
|
79
|
-
commandError: [event: XernerxMessage | XernerxSlashInteraction, error: XernerxError, command: XernerxSlashCommand | XernerxMessageCommand | XernerxContextCommand];
|
|
80
|
-
commandStart: [event: XernerxMessage | XernerxSlashInteraction, command: XernerxSlashCommand | XernerxMessageCommand | XernerxContextCommand];
|
|
81
|
-
commandFinish: [event: XernerxMessage | XernerxSlashInteraction, command: XernerxSlashCommand | XernerxMessageCommand | XernerxContextCommand];
|
|
82
|
-
commandNotFound: [event: XernerxMessage | XernerxSlashInteraction, commandName: string, filetype: 'MessageCommand' | 'SlashCommand' | 'ContextCommand'];
|
|
83
|
-
}
|
|
84
|
-
export {};
|
package/dist/types/extenders.js
DELETED