xernerx 4.17.9 → 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 +18 -37
- package/dist/main.js +23 -42
- package/dist/main.js.map +1 -0
- package/package.json +63 -48
- package/src/main.ts +26 -0
- package/dist/build/XernerxContextCommand.d.ts +0 -54
- package/dist/build/XernerxContextCommand.js +0 -121
- package/dist/build/XernerxEvent.d.ts +0 -21
- package/dist/build/XernerxEvent.js +0 -27
- package/dist/build/XernerxInhibitor.d.ts +0 -29
- package/dist/build/XernerxInhibitor.js +0 -27
- package/dist/build/XernerxMessageCommand.d.ts +0 -58
- package/dist/build/XernerxMessageCommand.js +0 -119
- package/dist/build/XernerxSlashCommand.d.ts +0 -70
- package/dist/build/XernerxSlashCommand.js +0 -178
- package/dist/client/XernerxClient.d.ts +0 -64
- package/dist/client/XernerxClient.js +0 -109
- package/dist/client/XernerxShardClient.d.ts +0 -21
- package/dist/client/XernerxShardClient.js +0 -54
- package/dist/functions/deploy.d.ts +0 -3
- package/dist/functions/deploy.js +0 -63
- package/dist/functions/load.d.ts +0 -4
- package/dist/functions/load.js +0 -35
- package/dist/functions/reload.d.ts +0 -3
- package/dist/functions/reload.js +0 -30
- package/dist/functions/setPresence.d.ts +0 -4
- package/dist/functions/setPresence.js +0 -21
- package/dist/handlers/CommandHandler.d.ts +0 -16
- package/dist/handlers/CommandHandler.js +0 -351
- package/dist/handlers/EventHandler.d.ts +0 -11
- package/dist/handlers/EventHandler.js +0 -84
- package/dist/handlers/ExtensionHandler.d.ts +0 -9
- package/dist/handlers/ExtensionHandler.js +0 -29
- package/dist/handlers/Handler.d.ts +0 -26
- package/dist/handlers/Handler.js +0 -64
- package/dist/handlers/InhibitorHandler.d.ts +0 -9
- package/dist/handlers/InhibitorHandler.js +0 -31
- package/dist/handlers/IntegrationHandler.d.ts +0 -15
- package/dist/handlers/IntegrationHandler.js +0 -26
- package/dist/models/Arguments.d.ts +0 -9
- package/dist/models/Arguments.js +0 -154
- package/dist/models/Cooldowns.d.ts +0 -11
- package/dist/models/Cooldowns.js +0 -33
- package/dist/models/XernerxEntitlement.d.ts +0 -45
- package/dist/models/XernerxEntitlement.js +0 -57
- package/dist/models/XernerxUser.d.ts +0 -14
- package/dist/models/XernerxUser.js +0 -13
- 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 -139
- package/dist/tools/XernerxText.d.ts +0 -31
- package/dist/tools/XernerxText.js +0 -94
- package/dist/types/extenders.d.ts +0 -76
- package/dist/types/extenders.js +0 -2
- package/dist/types/interfaces.d.ts +0 -258
- package/dist/types/interfaces.js +0 -2
- package/dist/types/types.d.ts +0 -12
- package/dist/types/types.js +0 -2
- package/dist/utils/ClientUtil.d.ts +0 -20
- package/dist/utils/ClientUtil.js +0 -123
- package/dist/utils/InteractionUtil.d.ts +0 -25
- package/dist/utils/InteractionUtil.js +0 -153
- package/dist/utils/MessageUtil.d.ts +0 -26
- package/dist/utils/MessageUtil.js +0 -167
- package/dist/utils/Util.d.ts +0 -12
- package/dist/utils/Util.js +0 -11
- package/dist/validators/commandValidation.d.ts +0 -7
- package/dist/validators/commandValidation.js +0 -124
- package/dist/validators/inhibitorValidations.d.ts +0 -9
- package/dist/validators/inhibitorValidations.js +0 -44
- package/tsup.config.ts +0 -19
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
/** @format */
|
|
2
|
-
export default class XernerxText {
|
|
3
|
-
user(user) {
|
|
4
|
-
if (typeof user == 'object')
|
|
5
|
-
user = user.id;
|
|
6
|
-
return `<@${user}>`;
|
|
7
|
-
}
|
|
8
|
-
channel(channel) {
|
|
9
|
-
if (typeof channel == 'object')
|
|
10
|
-
channel = channel.id;
|
|
11
|
-
return `<#${channel}>`;
|
|
12
|
-
}
|
|
13
|
-
role(role) {
|
|
14
|
-
if (typeof role == 'object')
|
|
15
|
-
role = role.id;
|
|
16
|
-
return `<@&${role}>`;
|
|
17
|
-
}
|
|
18
|
-
emoji(emoji, animated = false) {
|
|
19
|
-
if (typeof emoji == 'object')
|
|
20
|
-
emoji = emoji.id;
|
|
21
|
-
return `<${animated ? 'a' : ''}:${emoji}>`;
|
|
22
|
-
}
|
|
23
|
-
member(member) {
|
|
24
|
-
if (typeof member == 'object')
|
|
25
|
-
member = member.id;
|
|
26
|
-
return `<@!${member}>`;
|
|
27
|
-
}
|
|
28
|
-
command(id, name) {
|
|
29
|
-
if (typeof id !== 'string')
|
|
30
|
-
return null;
|
|
31
|
-
return `</${name}:${id}>`;
|
|
32
|
-
}
|
|
33
|
-
timestamp(timestamp = Date.now(), format = 'R') {
|
|
34
|
-
if (typeof timestamp == 'string')
|
|
35
|
-
timestamp = Number(timestamp);
|
|
36
|
-
if (isNaN(timestamp))
|
|
37
|
-
return 'Invalid Date';
|
|
38
|
-
return `<t:${timestamp}:${format}>`;
|
|
39
|
-
}
|
|
40
|
-
codeBlock(code, language) {
|
|
41
|
-
return `\`\`\`${language}
|
|
42
|
-
${code}
|
|
43
|
-
\`\`\``;
|
|
44
|
-
}
|
|
45
|
-
iCodeBlock(code) {
|
|
46
|
-
return `\`${code}\``;
|
|
47
|
-
}
|
|
48
|
-
bold(text) {
|
|
49
|
-
return `**${text}**`;
|
|
50
|
-
}
|
|
51
|
-
italic(text) {
|
|
52
|
-
return `*${text}*`;
|
|
53
|
-
}
|
|
54
|
-
underline(text) {
|
|
55
|
-
return `__${text}__`;
|
|
56
|
-
}
|
|
57
|
-
strike(text) {
|
|
58
|
-
return `~~${text}~~`;
|
|
59
|
-
}
|
|
60
|
-
spoiler(text) {
|
|
61
|
-
return `||${text}||`;
|
|
62
|
-
}
|
|
63
|
-
quote(text) {
|
|
64
|
-
return `> ${text}`;
|
|
65
|
-
}
|
|
66
|
-
blockQuote(text) {
|
|
67
|
-
return `>>> ${text}`;
|
|
68
|
-
}
|
|
69
|
-
hyperlink(text, url) {
|
|
70
|
-
return `[${text}](${url})`;
|
|
71
|
-
}
|
|
72
|
-
// public static HyperlinkWithTooltip(text: string, url: string, tooltip: string) {
|
|
73
|
-
// return `[${text}](${url} "${tooltip}")`;
|
|
74
|
-
// }
|
|
75
|
-
// public static HyperlinkWithTooltipAndImage(text: string, url: string, tooltip: string, imageUrl: string) {
|
|
76
|
-
// return `[${text}](${url} "${tooltip}":${imageUrl})`;
|
|
77
|
-
// }
|
|
78
|
-
// public static HyperlinkWithImage(text: string, url: string, imageUrl: string) {
|
|
79
|
-
// return `[${text}](${url}:${imageUrl})`;
|
|
80
|
-
// }
|
|
81
|
-
Progressbar(min, max, cur, options = {}) {
|
|
82
|
-
if (!options.fill)
|
|
83
|
-
options.fill = '█';
|
|
84
|
-
if (!options.fade)
|
|
85
|
-
options.fade = '▓▒';
|
|
86
|
-
if (!options.empty)
|
|
87
|
-
options.empty = '░';
|
|
88
|
-
const length = options.length || 20, percentage = cur / max, filledLength = Math.round(length * percentage), emptyLength = length - filledLength;
|
|
89
|
-
if (!options.percentage)
|
|
90
|
-
return '`' + options.fill.repeat(filledLength) + options.empty.repeat(emptyLength) + '`';
|
|
91
|
-
else
|
|
92
|
-
return '`' + options.fill.repeat(filledLength) + options.empty.repeat(emptyLength) + '` ' + `\`${percentage * 100}%\``;
|
|
93
|
-
}
|
|
94
|
-
}
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
/** @format */
|
|
2
|
-
import { ChatInputCommandInteraction, Collection, DMChannel, Guild, GuildChannel, GuildMember, Message, MessageContextMenuCommandInteraction, User, UserContextMenuCommandInteraction, ClientEvents } from 'discord.js';
|
|
3
|
-
import InteractionUtil from '../utils/InteractionUtil.js';
|
|
4
|
-
import MessageUtil from '../utils/MessageUtil.js';
|
|
5
|
-
import { ModuleOptions, XernerxCache, XernerxCommands } from '../types/interfaces.js';
|
|
6
|
-
import XernerxEvent from '../build/XernerxEvent.js';
|
|
7
|
-
import XernerxInhibitor from '../build/XernerxInhibitor.js';
|
|
8
|
-
import XernerxClient from '../client/XernerxClient.js';
|
|
9
|
-
import ClientUtil from '../utils/ClientUtil.js';
|
|
10
|
-
import { XernerxContextCommand, XernerxMessageCommand, XernerxSlashCommand } from '../main.js';
|
|
11
|
-
import XernerxError from '../tools/XernerxError.js';
|
|
12
|
-
export interface XernerxUser extends User {
|
|
13
|
-
owner: boolean;
|
|
14
|
-
voted?: boolean | null;
|
|
15
|
-
}
|
|
16
|
-
export interface XernerxMember extends GuildMember {
|
|
17
|
-
username: string;
|
|
18
|
-
}
|
|
19
|
-
export interface XernerxGuild extends Guild {
|
|
20
|
-
}
|
|
21
|
-
export interface XernerxGuildChannel extends GuildChannel {
|
|
22
|
-
}
|
|
23
|
-
export interface XernerxDMChannel extends DMChannel {
|
|
24
|
-
}
|
|
25
|
-
interface XernerxCommand {
|
|
26
|
-
}
|
|
27
|
-
export interface XernerxMessage extends Message, XernerxCommand {
|
|
28
|
-
user: XernerxUser;
|
|
29
|
-
util: MessageUtil;
|
|
30
|
-
}
|
|
31
|
-
export interface XernerxSlashInteraction extends ChatInputCommandInteraction, XernerxCommand {
|
|
32
|
-
user: XernerxUser;
|
|
33
|
-
util: InteractionUtil;
|
|
34
|
-
}
|
|
35
|
-
export interface XernerxUserContextInteraction extends UserContextMenuCommandInteraction, XernerxCommand {
|
|
36
|
-
user: XernerxUser;
|
|
37
|
-
util: InteractionUtil;
|
|
38
|
-
}
|
|
39
|
-
export interface XernerxMessageContextInteraction extends MessageContextMenuCommandInteraction, XernerxCommand {
|
|
40
|
-
user: XernerxUser;
|
|
41
|
-
util: InteractionUtil;
|
|
42
|
-
}
|
|
43
|
-
export interface XernerxClientType extends XernerxClient {
|
|
44
|
-
commands: XernerxCommands;
|
|
45
|
-
events: Collection<string, XernerxEvent<keyof XernerxClientEvents>>;
|
|
46
|
-
inhibitors: Collection<string, XernerxInhibitor>;
|
|
47
|
-
modules: ModuleOptions;
|
|
48
|
-
util: ClientUtil;
|
|
49
|
-
stats: {
|
|
50
|
-
guildCount: number;
|
|
51
|
-
userCount: number;
|
|
52
|
-
shardId: number;
|
|
53
|
-
shardCount: number;
|
|
54
|
-
};
|
|
55
|
-
cooldown: {
|
|
56
|
-
default: number;
|
|
57
|
-
cache: number;
|
|
58
|
-
collections: Array<string>;
|
|
59
|
-
};
|
|
60
|
-
cache: XernerxCache;
|
|
61
|
-
connect: () => Promise<string>;
|
|
62
|
-
}
|
|
63
|
-
interface CommandBlockInfo {
|
|
64
|
-
reason: string;
|
|
65
|
-
message: string;
|
|
66
|
-
required: Array<string> | string;
|
|
67
|
-
missing: Array<string> | string;
|
|
68
|
-
}
|
|
69
|
-
export interface XernerxClientEvents extends ClientEvents {
|
|
70
|
-
commandBlock: [event: XernerxMessage | XernerxSlashInteraction, info: CommandBlockInfo, command: XernerxSlashCommand | XernerxMessageCommand | XernerxContextCommand];
|
|
71
|
-
commandError: [event: XernerxMessage | XernerxSlashInteraction, error: XernerxError, command: XernerxSlashCommand | XernerxMessageCommand | XernerxContextCommand];
|
|
72
|
-
commandStart: [event: XernerxMessage | XernerxSlashInteraction, command: XernerxSlashCommand | XernerxMessageCommand | XernerxContextCommand];
|
|
73
|
-
commandFinish: [event: XernerxMessage | XernerxSlashInteraction, command: XernerxSlashCommand | XernerxMessageCommand | XernerxContextCommand];
|
|
74
|
-
commandNotFound: [event: XernerxMessage | XernerxSlashInteraction, commandName: string, filetype: 'MessageCommand' | 'SlashCommand' | 'ContextCommand'];
|
|
75
|
-
}
|
|
76
|
-
export {};
|
package/dist/types/extenders.js
DELETED
|
@@ -1,258 +0,0 @@
|
|
|
1
|
-
/** @format */
|
|
2
|
-
import { ActivityType, ChannelType, Collection, PresenceStatusData } from 'discord.js';
|
|
3
|
-
import CommandHandler from '../handlers/CommandHandler.js';
|
|
4
|
-
import EventHandler from '../handlers/EventHandler.js';
|
|
5
|
-
import InhibitorHandler from '../handlers/InhibitorHandler.js';
|
|
6
|
-
import IntegrationHandler from '../handlers/IntegrationHandler.js';
|
|
7
|
-
import XernerxContextCommand from '../build/XernerxContextCommand.js';
|
|
8
|
-
import MessageCommandBuilder from '../build/XernerxMessageCommand.js';
|
|
9
|
-
import XernerxSlashCommand from '../build/XernerxSlashCommand.js';
|
|
10
|
-
import { Locales, MessageCommandArgumentType, PermissionNames, SlashCommandArgumentType, InhibitorType } from './types.js';
|
|
11
|
-
import ExtensionHandler from '../handlers/ExtensionHandler.js';
|
|
12
|
-
import { XernerxClientEvents, XernerxMessage, XernerxUser } from './extenders.js';
|
|
13
|
-
export interface XernerxOptions {
|
|
14
|
-
local: string;
|
|
15
|
-
global?: boolean;
|
|
16
|
-
debug?: boolean;
|
|
17
|
-
ownerId?: string | Array<string>;
|
|
18
|
-
ceaseless?: boolean;
|
|
19
|
-
permissions?: {
|
|
20
|
-
user?: Array<PermissionNames> | Array<string> | null;
|
|
21
|
-
client?: Array<PermissionNames> | Array<string> | null;
|
|
22
|
-
dm?: boolean;
|
|
23
|
-
};
|
|
24
|
-
ignore?: {
|
|
25
|
-
owner?: boolean;
|
|
26
|
-
self?: boolean;
|
|
27
|
-
bots?: boolean;
|
|
28
|
-
system?: boolean;
|
|
29
|
-
users?: Array<string>;
|
|
30
|
-
channels?: Array<string>;
|
|
31
|
-
guilds?: Array<string>;
|
|
32
|
-
};
|
|
33
|
-
log?: {
|
|
34
|
-
ready?: boolean;
|
|
35
|
-
info?: boolean;
|
|
36
|
-
warn?: boolean;
|
|
37
|
-
error?: boolean;
|
|
38
|
-
table?: Array<'name' | 'aliases' | 'description' | 'filetype' | 'category'>;
|
|
39
|
-
format?: Array<'name' | 'node' | 'xernerx' | 'discordjs' | 'platform' | 'time' | 'date' | 'ram' | 'version' | 'author' | 'shard' | 'index'>;
|
|
40
|
-
} | boolean;
|
|
41
|
-
cooldown?: {
|
|
42
|
-
command?: number;
|
|
43
|
-
cache?: number;
|
|
44
|
-
collections?: Array<string>;
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
|
-
export interface ModuleOptions {
|
|
48
|
-
options: {
|
|
49
|
-
message?: MessageHandlerOptions;
|
|
50
|
-
slash?: SlashHandlerOptions;
|
|
51
|
-
context?: ContextHandlerOptions;
|
|
52
|
-
events?: EventHandlerOptions;
|
|
53
|
-
inhibitors?: InhibitorHandlerOptions;
|
|
54
|
-
};
|
|
55
|
-
commandHandler: CommandHandler;
|
|
56
|
-
eventHandler: EventHandler;
|
|
57
|
-
inhibitorHandler: InhibitorHandler;
|
|
58
|
-
integrationHandler: IntegrationHandler;
|
|
59
|
-
extensionHandler: ExtensionHandler;
|
|
60
|
-
}
|
|
61
|
-
export interface XernerxCommands {
|
|
62
|
-
message: Collection<string, MessageCommandBuilder>;
|
|
63
|
-
slash: Collection<string, XernerxSlashCommand>;
|
|
64
|
-
context: Collection<string, XernerxContextCommand>;
|
|
65
|
-
}
|
|
66
|
-
export interface DBLOptions {
|
|
67
|
-
topgg: {
|
|
68
|
-
token: string;
|
|
69
|
-
};
|
|
70
|
-
dbl: {
|
|
71
|
-
token: string;
|
|
72
|
-
};
|
|
73
|
-
config: {
|
|
74
|
-
emits: boolean;
|
|
75
|
-
logs: boolean;
|
|
76
|
-
};
|
|
77
|
-
}
|
|
78
|
-
export interface XernerxCache {
|
|
79
|
-
messages: Collection<string, string>;
|
|
80
|
-
cooldowns: Collection<string, {
|
|
81
|
-
id: string;
|
|
82
|
-
command: string;
|
|
83
|
-
createdTimestamp: number;
|
|
84
|
-
}>;
|
|
85
|
-
}
|
|
86
|
-
interface CommandHandlerOptions {
|
|
87
|
-
directory: string;
|
|
88
|
-
cooldown?: number;
|
|
89
|
-
permissions?: {
|
|
90
|
-
user?: Array<PermissionNames> | Array<string> | null;
|
|
91
|
-
client?: Array<PermissionNames> | Array<string> | null;
|
|
92
|
-
dm?: boolean;
|
|
93
|
-
};
|
|
94
|
-
}
|
|
95
|
-
export interface MessageHandlerOptions extends CommandHandlerOptions {
|
|
96
|
-
prefix: string | Array<string>;
|
|
97
|
-
allowMention?: boolean;
|
|
98
|
-
handleEdits?: boolean;
|
|
99
|
-
handleDeletes?: boolean;
|
|
100
|
-
handleTyping?: boolean;
|
|
101
|
-
}
|
|
102
|
-
export interface SlashHandlerOptions extends CommandHandlerOptions {
|
|
103
|
-
defer?: {
|
|
104
|
-
reply?: boolean;
|
|
105
|
-
ephemeral?: boolean;
|
|
106
|
-
fetchReply?: boolean;
|
|
107
|
-
};
|
|
108
|
-
}
|
|
109
|
-
export interface ContextHandlerOptions extends CommandHandlerOptions {
|
|
110
|
-
defer?: {
|
|
111
|
-
reply?: boolean;
|
|
112
|
-
ephemeral?: boolean;
|
|
113
|
-
fetchReply?: boolean;
|
|
114
|
-
};
|
|
115
|
-
}
|
|
116
|
-
export interface EventHandlerOptions {
|
|
117
|
-
directory: string;
|
|
118
|
-
}
|
|
119
|
-
export interface InhibitorHandlerOptions {
|
|
120
|
-
directory: string;
|
|
121
|
-
}
|
|
122
|
-
interface CommandOptions {
|
|
123
|
-
name: string;
|
|
124
|
-
description?: string | null;
|
|
125
|
-
usage?: string | null;
|
|
126
|
-
info?: string | null;
|
|
127
|
-
category?: string | null;
|
|
128
|
-
cooldown?: number | null;
|
|
129
|
-
global?: boolean;
|
|
130
|
-
channel?: Array<keyof typeof ChannelType> | keyof typeof ChannelType | null;
|
|
131
|
-
ignore?: {
|
|
132
|
-
owner?: boolean;
|
|
133
|
-
users?: Array<string>;
|
|
134
|
-
channels?: Array<string>;
|
|
135
|
-
guilds?: Array<string>;
|
|
136
|
-
voice?: boolean;
|
|
137
|
-
};
|
|
138
|
-
strict?: {
|
|
139
|
-
owner?: boolean;
|
|
140
|
-
users?: Array<string>;
|
|
141
|
-
channels?: Array<string>;
|
|
142
|
-
guilds?: Array<string>;
|
|
143
|
-
voice?: boolean;
|
|
144
|
-
};
|
|
145
|
-
permissions?: {
|
|
146
|
-
user?: Array<PermissionNames> | Array<string> | null;
|
|
147
|
-
client?: Array<PermissionNames> | Array<string> | null;
|
|
148
|
-
dm?: boolean;
|
|
149
|
-
};
|
|
150
|
-
}
|
|
151
|
-
export interface MessageCommandOptions extends CommandOptions {
|
|
152
|
-
aliases?: Array<string>;
|
|
153
|
-
separator?: string;
|
|
154
|
-
prefix?: Array<string> | string;
|
|
155
|
-
regex?: RegExp;
|
|
156
|
-
channelType?: Array<ChannelType>;
|
|
157
|
-
args?: Array<MessageCommandArgumentOptions>;
|
|
158
|
-
flags?: Array<MessageCommandFlagOptions>;
|
|
159
|
-
}
|
|
160
|
-
export interface MessageCommandArgumentOptions {
|
|
161
|
-
type: MessageCommandArgumentType;
|
|
162
|
-
name: string;
|
|
163
|
-
content?: Array<string>;
|
|
164
|
-
match?: string | Array<string>;
|
|
165
|
-
description?: string;
|
|
166
|
-
default?: string | Function;
|
|
167
|
-
separator?: string | RegExp;
|
|
168
|
-
prompt?: {
|
|
169
|
-
reply?: string;
|
|
170
|
-
send?: string;
|
|
171
|
-
};
|
|
172
|
-
}
|
|
173
|
-
export interface MessageCommandFlagOptions {
|
|
174
|
-
name: string;
|
|
175
|
-
match: string;
|
|
176
|
-
}
|
|
177
|
-
export interface MessageCommandArguments {
|
|
178
|
-
args: Record<string, unknown> | null;
|
|
179
|
-
flags: Record<string, boolean> | null;
|
|
180
|
-
}
|
|
181
|
-
export interface SlashCommandOptions extends CommandOptions {
|
|
182
|
-
description: string;
|
|
183
|
-
nameLocalizations?: Record<Locales, string | null> | null;
|
|
184
|
-
descriptionLocalizations?: Record<Locales, string | null> | null;
|
|
185
|
-
defer?: {
|
|
186
|
-
reply?: boolean;
|
|
187
|
-
ephemeral?: boolean;
|
|
188
|
-
fetchReply?: boolean;
|
|
189
|
-
};
|
|
190
|
-
args?: Array<SlashCommandArgumentOptions>;
|
|
191
|
-
subcommands?: Array<SlashCommandSubcommandOptions>;
|
|
192
|
-
groups?: Array<SlashCommandGroupOptions>;
|
|
193
|
-
}
|
|
194
|
-
export interface ContextCommandOptions extends CommandOptions {
|
|
195
|
-
type: 'user' | 'message';
|
|
196
|
-
nameLocalizations?: Record<Locales, string | null> | null;
|
|
197
|
-
defer?: {
|
|
198
|
-
reply?: boolean;
|
|
199
|
-
ephemeral?: boolean;
|
|
200
|
-
fetchReply?: boolean;
|
|
201
|
-
};
|
|
202
|
-
}
|
|
203
|
-
export interface SlashCommandArgumentOptions {
|
|
204
|
-
type: SlashCommandArgumentType;
|
|
205
|
-
name: string;
|
|
206
|
-
description: string;
|
|
207
|
-
required?: boolean;
|
|
208
|
-
autocomplete?: boolean;
|
|
209
|
-
choices?: Array<Record<string, string>>;
|
|
210
|
-
}
|
|
211
|
-
export interface SlashCommandSubcommandOptions {
|
|
212
|
-
name: string;
|
|
213
|
-
description: string;
|
|
214
|
-
args?: Array<SlashCommandArgumentOptions>;
|
|
215
|
-
}
|
|
216
|
-
export interface SlashCommandGroupOptions {
|
|
217
|
-
name: string;
|
|
218
|
-
description: string;
|
|
219
|
-
subcommands: Array<SlashCommandSubcommandOptions>;
|
|
220
|
-
}
|
|
221
|
-
export interface SlashCommandArguments<T = SlashCommandArgumentType> {
|
|
222
|
-
args: Record<string, any>;
|
|
223
|
-
subcommand: string;
|
|
224
|
-
group: string;
|
|
225
|
-
}
|
|
226
|
-
export interface XernerxEventOptions {
|
|
227
|
-
name: keyof XernerxClientEvents;
|
|
228
|
-
emitter?: 'client' | 'process';
|
|
229
|
-
type?: 'discord' | 'node';
|
|
230
|
-
once?: boolean;
|
|
231
|
-
}
|
|
232
|
-
export interface XernerxInhibitorOptions {
|
|
233
|
-
name: string;
|
|
234
|
-
type: InhibitorType;
|
|
235
|
-
}
|
|
236
|
-
export interface PresenceOptions {
|
|
237
|
-
text: string;
|
|
238
|
-
type?: keyof typeof ActivityType;
|
|
239
|
-
url?: string;
|
|
240
|
-
status?: PresenceStatusData;
|
|
241
|
-
interval?: number;
|
|
242
|
-
}
|
|
243
|
-
export type ContextCommandArguments<T extends 'user' | 'message'> = T extends 'user' ? XernerxUser : XernerxMessage;
|
|
244
|
-
export interface PaginatorOptions {
|
|
245
|
-
type?: 'button' | 'select-menu' | 'combined';
|
|
246
|
-
buttons?: Array<string>;
|
|
247
|
-
description?: boolean;
|
|
248
|
-
placeholder?: string;
|
|
249
|
-
index?: number;
|
|
250
|
-
send?: boolean;
|
|
251
|
-
filter?: Function;
|
|
252
|
-
time?: number;
|
|
253
|
-
}
|
|
254
|
-
export interface ResolveCommandOptions {
|
|
255
|
-
type?: 'MessageCommand' | 'SlashCommand' | 'ContextCommand' | 'Interaction';
|
|
256
|
-
name?: string;
|
|
257
|
-
}
|
|
258
|
-
export {};
|
package/dist/types/interfaces.js
DELETED
package/dist/types/types.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/** @format */
|
|
2
|
-
import { SlashCommandBooleanOption, SlashCommandChannelOption, SlashCommandIntegerOption, SlashCommandMentionableOption, SlashCommandNumberOption, SlashCommandRoleOption, SlashCommandStringOption, SlashCommandUserOption } from 'discord.js';
|
|
3
|
-
import { XernerxMessageContextInteraction, XernerxSlashInteraction, XernerxUserContextInteraction } from './extenders.js';
|
|
4
|
-
export type filetype = 'MessageCommand' | 'SlashCommand' | 'ContextCommand' | 'Event' | 'Inhibitor';
|
|
5
|
-
export type Locales = 'en-US' | 'en-GB' | 'bg' | 'zh-CN' | 'zh-TW' | 'hr' | 'cs' | 'da' | 'nl' | 'fi' | 'fr' | 'de' | 'el' | 'hi' | 'hu' | 'it' | 'ja' | 'ko' | 'lt' | 'no' | 'pl' | 'pt-BR' | 'ro' | 'ru' | 'es-ES' | 'sv-SE' | 'th' | 'tr' | 'uk' | 'vi';
|
|
6
|
-
export type SlashCommandArgumentType = 'attachment' | 'boolean' | 'channel' | 'integer' | 'mentionable' | 'number' | 'role' | 'string' | 'user';
|
|
7
|
-
export type SlashCommandOptionChoices = SlashCommandStringOption | SlashCommandNumberOption | SlashCommandIntegerOption;
|
|
8
|
-
export type SlashCommandOption = SlashCommandOptionChoices | SlashCommandBooleanOption | SlashCommandUserOption | SlashCommandChannelOption | SlashCommandRoleOption | SlashCommandMentionableOption;
|
|
9
|
-
export type MessageCommandArgumentType = 'string' | 'number' | 'boolean' | 'confirm' | 'channel' | 'guild' | 'integer' | 'mentionable' | 'role' | 'user' | 'message' | 'member' | 'list' | 'option' | 'rest';
|
|
10
|
-
export type XernerxInteraction<T extends XernerxSlashInteraction | XernerxUserContextInteraction | XernerxMessageContextInteraction> = T extends XernerxSlashInteraction ? XernerxSlashInteraction : T extends XernerxUserContextInteraction ? XernerxUserContextInteraction : XernerxMessageContextInteraction;
|
|
11
|
-
export type PermissionNames = 'create instant invite' | 'kick members' | 'ban members' | 'administrator' | 'manage channels' | 'manage guild' | 'add reactions' | 'view audit log' | 'priority speaker' | 'stream' | 'view channel' | 'send messages' | 'send tts messages' | 'manage messages' | 'embed links' | 'attach files' | 'read message history' | 'mention everyone' | 'use external emojis' | 'view guild insights' | 'connect' | 'speak' | 'mute members' | 'deafen members' | 'move members' | 'use vad' | 'change nickname' | 'manage nicknames' | 'manage roles' | 'manage webhooks' | 'manage emojis and stickers' | 'use application commands' | 'request to speak' | 'manage events' | 'manage threads' | 'create public threads' | 'create private threads' | 'use external stickers' | 'send messages in threads' | 'start embedded activities' | 'moderate members';
|
|
12
|
-
export type InhibitorType = '*' | 'message' | 'interaction' | 'command' | 'channel' | 'user' | 'member' | 'guild' | 'contextCommand' | 'messageCommand' | 'slashCommand';
|
package/dist/types/types.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/** @format */
|
|
2
|
-
import { Collection } from 'discord.js';
|
|
3
|
-
import XernerxClient from '../client/XernerxClient.js';
|
|
4
|
-
import { PresenceOptions, ResolveCommandOptions } from '../types/interfaces.js';
|
|
5
|
-
import Util from './Util.js';
|
|
6
|
-
import XernerxContextCommand from '../build/XernerxContextCommand.js';
|
|
7
|
-
import XernerxMessageCommand from '../build/XernerxMessageCommand.js';
|
|
8
|
-
import XernerxSlashCommand from '../build/XernerxSlashCommand.js';
|
|
9
|
-
export default class ClientUtil extends Util {
|
|
10
|
-
hasVoted: Function;
|
|
11
|
-
constructor(client: XernerxClient);
|
|
12
|
-
setPresence(options: PresenceOptions): import("discord.js").ClientPresence | undefined;
|
|
13
|
-
private resolveCooldown;
|
|
14
|
-
resolveCommand(options: ResolveCommandOptions): Promise<XernerxSlashCommand | XernerxContextCommand | XernerxMessageCommand | Collection<string, XernerxSlashCommand | XernerxContextCommand | XernerxMessageCommand>>;
|
|
15
|
-
resolveChannel(query: string | Record<string, string>): Promise<import("discord.js").Channel | null>;
|
|
16
|
-
resolveGuild(query: string | Record<string, string>): Promise<import("discord.js").Guild | null>;
|
|
17
|
-
uptime(timestamp?: number | null): string;
|
|
18
|
-
commands(): (XernerxSlashCommand | XernerxContextCommand | XernerxMessageCommand)[];
|
|
19
|
-
commandsList(): Collection<string, object>;
|
|
20
|
-
}
|
package/dist/utils/ClientUtil.js
DELETED
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
/** @format */
|
|
2
|
-
import { Collection } from 'discord.js';
|
|
3
|
-
import setPresence from '../functions/setPresence.js';
|
|
4
|
-
import Util from './Util.js';
|
|
5
|
-
export default class ClientUtil extends Util {
|
|
6
|
-
constructor(client) {
|
|
7
|
-
super(client);
|
|
8
|
-
this.setPresence = this.setPresence;
|
|
9
|
-
this.resolveCooldown = this.resolveCooldown;
|
|
10
|
-
this.resolveChannel = this.resolveChannel;
|
|
11
|
-
this.commands = this.commands;
|
|
12
|
-
this.resolveGuild = this.resolveGuild;
|
|
13
|
-
this.uptime = this.uptime;
|
|
14
|
-
}
|
|
15
|
-
setPresence(options) {
|
|
16
|
-
return setPresence(this.client, options);
|
|
17
|
-
}
|
|
18
|
-
// @ts-ignore
|
|
19
|
-
resolveCooldown() { }
|
|
20
|
-
async resolveCommand(options) {
|
|
21
|
-
const interCommands = await this.client.application?.commands.fetch();
|
|
22
|
-
const commands = [], collection = new Collection();
|
|
23
|
-
if (options?.type == 'MessageCommand' || !options?.type)
|
|
24
|
-
commands.push(...this.client.commands.message);
|
|
25
|
-
if (options?.type == 'Interaction' || options?.type == 'SlashCommand' || !options?.type)
|
|
26
|
-
commands.push(...this.client.commands.slash);
|
|
27
|
-
if (options?.type == 'Interaction' || options?.type == 'ContextCommand' || !options?.type)
|
|
28
|
-
commands.push(...this.client.commands.context);
|
|
29
|
-
commands.map(([name, command]) => {
|
|
30
|
-
command.snowflake = interCommands?.find((cmd) => command.name === cmd.name)?.id || null;
|
|
31
|
-
collection.set(name, command);
|
|
32
|
-
});
|
|
33
|
-
if (options?.name) {
|
|
34
|
-
return collection.get(options.name) || null;
|
|
35
|
-
}
|
|
36
|
-
else
|
|
37
|
-
return collection;
|
|
38
|
-
}
|
|
39
|
-
async resolveChannel(query) {
|
|
40
|
-
if (typeof query == 'object')
|
|
41
|
-
query = query.id;
|
|
42
|
-
try {
|
|
43
|
-
let channel = this.client.channels.cache.find((channel) => channel.name == query.toLowerCase() || channel.id == query.toLowerCase() ? channel : null) || null;
|
|
44
|
-
if (!channel)
|
|
45
|
-
channel = (await this.client.channels.fetch(query)) || null;
|
|
46
|
-
return channel;
|
|
47
|
-
}
|
|
48
|
-
catch {
|
|
49
|
-
return null;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
async resolveGuild(query) {
|
|
53
|
-
if (typeof query == 'object')
|
|
54
|
-
query = query.id;
|
|
55
|
-
try {
|
|
56
|
-
let guild = this.client.guilds.cache.find((guild) => guild.name.toLowerCase() == query.toLowerCase()) || null;
|
|
57
|
-
if (!guild)
|
|
58
|
-
guild = (await this.client.guilds.fetch(query)) || null;
|
|
59
|
-
return guild;
|
|
60
|
-
}
|
|
61
|
-
catch {
|
|
62
|
-
return null;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
uptime(timestamp) {
|
|
66
|
-
if (!timestamp)
|
|
67
|
-
timestamp = this.client.uptime || 0;
|
|
68
|
-
let totalSeconds = timestamp / 1000;
|
|
69
|
-
let years = Math.floor(totalSeconds / 31536000);
|
|
70
|
-
totalSeconds %= 31536000;
|
|
71
|
-
let days = Math.floor(totalSeconds / 86400);
|
|
72
|
-
totalSeconds %= 86400;
|
|
73
|
-
let hours = Math.floor(totalSeconds / 3600);
|
|
74
|
-
totalSeconds %= 3600;
|
|
75
|
-
let minutes = Math.floor(totalSeconds / 60);
|
|
76
|
-
let seconds = Math.floor(totalSeconds % 60);
|
|
77
|
-
if (years >= 1)
|
|
78
|
-
return `${years}y ${days}d ${hours}h ${minutes}m`;
|
|
79
|
-
else if (days >= 1)
|
|
80
|
-
return `${days}d ${hours}h ${minutes}m`;
|
|
81
|
-
else if (hours >= 1)
|
|
82
|
-
return `${hours}h ${minutes}m`;
|
|
83
|
-
else if (minutes >= 1)
|
|
84
|
-
return `${minutes}m ${seconds}s`;
|
|
85
|
-
else
|
|
86
|
-
return `${seconds}s`;
|
|
87
|
-
}
|
|
88
|
-
commands() {
|
|
89
|
-
return [...this.client.commands.context.toJSON(), ...this.client.commands.slash.toJSON(), ...this.client.commands.message.toJSON()];
|
|
90
|
-
}
|
|
91
|
-
commandsList() {
|
|
92
|
-
function set(name, type, description, usage) {
|
|
93
|
-
return collection.set(name, { name, type, description, usage });
|
|
94
|
-
}
|
|
95
|
-
const commands = this.commands();
|
|
96
|
-
const collection = new Collection();
|
|
97
|
-
commands.map((command) => {
|
|
98
|
-
if (command.filetype == 'MessageCommand' || command.filetype == 'ContextCommand')
|
|
99
|
-
return set(command.name, command.filetype, command.description, command.usage);
|
|
100
|
-
else if (command.data.options.length) {
|
|
101
|
-
command.data.options.map((option) => {
|
|
102
|
-
if (!option.type) {
|
|
103
|
-
if (option.options.length) {
|
|
104
|
-
option.options.map((o) => {
|
|
105
|
-
if (!o.type)
|
|
106
|
-
set(`${command.name} ${option.name} ${o.name}`, command.filetype, o.description, command.usage);
|
|
107
|
-
else
|
|
108
|
-
set(`${command.name} ${option.name}`, command.filetype, option.description, command.usage);
|
|
109
|
-
});
|
|
110
|
-
}
|
|
111
|
-
else {
|
|
112
|
-
set(`${command.name} ${option.name}`, command.filetype, option.description, command.usage);
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
});
|
|
116
|
-
}
|
|
117
|
-
else {
|
|
118
|
-
set(command.name, command.filetype, command.description, command.usage);
|
|
119
|
-
}
|
|
120
|
-
});
|
|
121
|
-
return collection;
|
|
122
|
-
}
|
|
123
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/** @format */
|
|
2
|
-
import { EmbedBuilder, InteractionEditReplyOptions, InteractionReplyOptions, MessageCreateOptions, MessagePayload } from 'discord.js';
|
|
3
|
-
import XernerxClient from '../client/XernerxClient.js';
|
|
4
|
-
import { ContextCommandArguments, PaginatorOptions, SlashCommandArguments } from '../types/interfaces.js';
|
|
5
|
-
import { PermissionNames, XernerxInteraction } from '../types/types.js';
|
|
6
|
-
import Util from './Util.js';
|
|
7
|
-
import { XernerxMessageContextInteraction, XernerxSlashInteraction, XernerxUser, XernerxUserContextInteraction } from '../types/extenders.js';
|
|
8
|
-
type MimicOptions = {
|
|
9
|
-
timeout: number;
|
|
10
|
-
};
|
|
11
|
-
export default class InteractionUtil extends Util {
|
|
12
|
-
private readonly interaction;
|
|
13
|
-
parsed: {
|
|
14
|
-
alias: string | null;
|
|
15
|
-
args: (SlashCommandArguments | ContextCommandArguments<'message' | 'user'>) | null;
|
|
16
|
-
};
|
|
17
|
-
constructor(client: XernerxClient, interaction: XernerxInteraction<XernerxSlashInteraction | XernerxUserContextInteraction | XernerxMessageContextInteraction>);
|
|
18
|
-
send(content: any): Promise<any>;
|
|
19
|
-
reply(content: string | MessagePayload | InteractionReplyOptions | InteractionEditReplyOptions): Promise<import("discord.js").Message<boolean> | import("discord.js").InteractionResponse<boolean>>;
|
|
20
|
-
mimic(user: XernerxUser | string, interaction: MessageCreateOptions, options: MimicOptions): Promise<void>;
|
|
21
|
-
paginator(embeds: Array<EmbedBuilder>, options?: PaginatorOptions): Promise<any>;
|
|
22
|
-
commands(): import("discord.js").Collection<string, import("../main.js").XernerxSlashCommand> | import("discord.js").Collection<string, import("../main.js").XernerxContextCommand>;
|
|
23
|
-
permissionCheck(type: 'user' | 'client', permissions: Array<PermissionNames>, emit?: boolean): boolean | string[];
|
|
24
|
-
}
|
|
25
|
-
export {};
|