xernerx 4.4.9 → 4.4.11

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.
Files changed (99) hide show
  1. package/dist/build/ContextCommandBuilder.js +1 -0
  2. package/dist/build/ContextCommandBuilder.js.map +1 -0
  3. package/dist/build/EventBuilder.js +1 -0
  4. package/dist/build/EventBuilder.js.map +1 -0
  5. package/dist/build/InhibitorBuilder.js +1 -2
  6. package/dist/build/InhibitorBuilder.js.map +1 -0
  7. package/dist/build/MessageCommandBuilder.js +1 -0
  8. package/dist/build/MessageCommandBuilder.js.map +1 -0
  9. package/dist/build/SlashCommandBuilder.js +1 -0
  10. package/dist/build/SlashCommandBuilder.js.map +1 -0
  11. package/dist/client/XernerxClient.js +6 -5
  12. package/dist/client/XernerxClient.js.map +1 -0
  13. package/dist/functions/deploy.js +1 -0
  14. package/dist/functions/deploy.js.map +1 -0
  15. package/dist/functions/isOwner.js +1 -0
  16. package/dist/functions/isOwner.js.map +1 -0
  17. package/dist/functions/isVoter.js +1 -0
  18. package/dist/functions/isVoter.js.map +1 -0
  19. package/dist/functions/load.js +1 -0
  20. package/dist/functions/load.js.map +1 -0
  21. package/dist/functions/reload.js +1 -0
  22. package/dist/functions/reload.js.map +1 -0
  23. package/dist/functions/setPresence.js +1 -0
  24. package/dist/functions/setPresence.js.map +1 -0
  25. package/dist/functions/xernerxUser.js +1 -0
  26. package/dist/functions/xernerxUser.js.map +1 -0
  27. package/dist/handlers/CommandHandler.js +2 -1
  28. package/dist/handlers/CommandHandler.js.map +1 -0
  29. package/dist/handlers/EventHandler.js +1 -0
  30. package/dist/handlers/EventHandler.js.map +1 -0
  31. package/dist/handlers/ExtensionHandler.js +2 -1
  32. package/dist/handlers/ExtensionHandler.js.map +1 -0
  33. package/dist/handlers/Handler.js +1 -0
  34. package/dist/handlers/Handler.js.map +1 -0
  35. package/dist/handlers/InhibitorHandler.js +1 -0
  36. package/dist/handlers/InhibitorHandler.js.map +1 -0
  37. package/dist/handlers/WebhookHandler.js +1 -0
  38. package/dist/handlers/WebhookHandler.js.map +1 -0
  39. package/dist/main.js +1 -0
  40. package/dist/main.js.map +13 -0
  41. package/dist/models/Arguments.js +2 -1
  42. package/dist/models/Arguments.js.map +1 -0
  43. package/dist/tools/XernerxLog.js +6 -0
  44. package/dist/tools/XernerxLog.js.map +1 -0
  45. package/dist/types/interfaces.js +1 -0
  46. package/dist/types/interfaces.js.map +1 -0
  47. package/dist/utils/ClientUtil.js +1 -0
  48. package/dist/utils/ClientUtil.js.map +1 -0
  49. package/dist/utils/InteractionUtil.js +1 -0
  50. package/dist/utils/InteractionUtil.js.map +1 -0
  51. package/dist/utils/MessageUtil.js +1 -0
  52. package/dist/utils/MessageUtil.js.map +1 -0
  53. package/dist/utils/Util.js +1 -0
  54. package/dist/utils/Util.js.map +1 -0
  55. package/dist/validators/commandValidation.js +1 -0
  56. package/dist/validators/commandValidation.js.map +1 -0
  57. package/package.json +1 -1
  58. package/dist/build/ContextCommandBuilder.d.ts +0 -42
  59. package/dist/build/EventBuilder.d.ts +0 -24
  60. package/dist/build/InhibitorBuilder.d.ts +0 -19
  61. package/dist/build/MessageCommandBuilder.d.ts +0 -41
  62. package/dist/build/SlashCommandBuilder.d.ts +0 -47
  63. package/dist/client/XernerxClient.d.ts +0 -47
  64. package/dist/client/XernerxShardClient.d.ts +0 -16
  65. package/dist/client/XernerxShardClient.js +0 -30
  66. package/dist/functions/delay.d.ts +0 -1
  67. package/dist/functions/delay.js +0 -3
  68. package/dist/functions/deploy.d.ts +0 -2
  69. package/dist/functions/isOwner.d.ts +0 -3
  70. package/dist/functions/isVoter.d.ts +0 -3
  71. package/dist/functions/load.d.ts +0 -3
  72. package/dist/functions/reload.d.ts +0 -2
  73. package/dist/functions/sendWebhook.d.ts +0 -2
  74. package/dist/functions/sendWebhook.js +0 -13
  75. package/dist/functions/setPresence.d.ts +0 -3
  76. package/dist/functions/xernerxUser.d.ts +0 -3
  77. package/dist/handlers/CommandHandler.d.ts +0 -13
  78. package/dist/handlers/EventHandler.d.ts +0 -7
  79. package/dist/handlers/ExtensionHandler.d.ts +0 -7
  80. package/dist/handlers/Handler.d.ts +0 -14
  81. package/dist/handlers/InhibitorHandler.d.ts +0 -7
  82. package/dist/handlers/WebhookHandler.d.ts +0 -9
  83. package/dist/main.d.ts +0 -35
  84. package/dist/models/Arguments.d.ts +0 -8
  85. package/dist/tools/XernerxError.d.ts +0 -6
  86. package/dist/tools/XernerxError.js +0 -10
  87. package/dist/tools/XernerxLog.d.ts +0 -14
  88. package/dist/types/extenders.d.ts +0 -32
  89. package/dist/types/extenders.js +0 -1
  90. package/dist/types/interfaces.d.ts +0 -230
  91. package/dist/types/types.d.ts +0 -13
  92. package/dist/types/types.js +0 -1
  93. package/dist/utils/ClientUtil.d.ts +0 -10
  94. package/dist/utils/InteractionUtil.d.ts +0 -10
  95. package/dist/utils/MessageUtil.d.ts +0 -15
  96. package/dist/utils/Util.d.ts +0 -5
  97. package/dist/validators/commandValidation.d.ts +0 -6
  98. package/dist/validators/inhibitorValidations.d.ts +0 -5
  99. package/dist/validators/inhibitorValidations.js +0 -34
@@ -1,230 +0,0 @@
1
- import { ActivityType, ChannelType, Collection, PresenceStatusData } from 'discord.js';
2
- import CommandHandler from '../handlers/CommandHandler.js';
3
- import EventHandler from '../handlers/EventHandler.js';
4
- import InhibitorHandler from '../handlers/InhibitorHandler.js';
5
- import WebhookHandler from '../handlers/WebhookHandler.js';
6
- import ContextCommandBuilder from '../build/ContextCommandBuilder.js';
7
- import MessageCommandBuilder from '../build/MessageCommandBuilder.js';
8
- import SlashCommandBuilder from '../build/SlashCommandBuilder.js';
9
- import { Locales, MessageCommandArgumentType, PermissionNames, SlashCommandArgumentType, EventType, InhibitorType } from './types.js';
10
- import ExtensionHandler from '../handlers/ExtensionHandler.js';
11
- export interface XernerxOptions {
12
- local?: string;
13
- global?: boolean;
14
- ownerId?: string | Array<string>;
15
- permissions?: {
16
- client?: Array<string>;
17
- user?: Array<string>;
18
- dm?: boolean;
19
- };
20
- ignore?: {
21
- owner?: boolean;
22
- users?: Array<string>;
23
- channels?: Array<string>;
24
- guilds?: Array<string>;
25
- };
26
- log?: {
27
- ready?: boolean;
28
- info?: boolean;
29
- error?: boolean;
30
- table?: Array<'name' | 'aliases' | 'description' | 'fileType' | 'category'>;
31
- };
32
- cooldown?: {
33
- command?: number;
34
- cache?: number;
35
- };
36
- }
37
- export interface ModuleOptions {
38
- options: {
39
- message?: MessageHandlerOptions;
40
- slash?: SlashHandlerOptions;
41
- context?: ContextHandlerOptions;
42
- events?: EventHandlerOptions;
43
- inhibitors?: InhibitorHandlerOptions;
44
- };
45
- commandHandler: CommandHandler;
46
- eventHandler: EventHandler;
47
- inhibitorHandler: InhibitorHandler;
48
- webhookHandler: WebhookHandler;
49
- extensionHandler: ExtensionHandler;
50
- }
51
- export interface XernerxCommands {
52
- message: Collection<string, MessageCommandBuilder>;
53
- slash: Collection<string, SlashCommandBuilder>;
54
- context: Collection<string, ContextCommandBuilder>;
55
- }
56
- export interface DBLOptions {
57
- topgg: {
58
- token: string;
59
- };
60
- dbl: {
61
- token: string;
62
- };
63
- config: {
64
- emits: boolean;
65
- logs: boolean;
66
- };
67
- }
68
- export interface XernerxCache {
69
- messages: Collection<string, string>;
70
- cooldowns: Collection<string, {
71
- id: string;
72
- command: string;
73
- createdTimestamp: number;
74
- }>;
75
- }
76
- interface CommandHandlerOptions {
77
- directory: string;
78
- cooldown?: number;
79
- permissions?: {
80
- user?: Array<string>;
81
- client?: Array<string>;
82
- dm?: boolean;
83
- };
84
- logging?: boolean;
85
- }
86
- export interface MessageHandlerOptions extends CommandHandlerOptions {
87
- prefix: string | Array<string>;
88
- allowMention?: boolean;
89
- handleEdits?: boolean;
90
- handleDeletes?: boolean;
91
- handleTyping?: boolean;
92
- }
93
- export interface SlashHandlerOptions extends CommandHandlerOptions {
94
- defer?: {
95
- reply?: boolean;
96
- ephemeral?: boolean;
97
- fetchReply?: boolean;
98
- };
99
- }
100
- export interface ContextHandlerOptions extends CommandHandlerOptions {
101
- defer?: {
102
- reply?: boolean;
103
- ephemeral?: boolean;
104
- fetchReply?: boolean;
105
- };
106
- }
107
- export interface EventHandlerOptions {
108
- directory: string;
109
- }
110
- export interface InhibitorHandlerOptions {
111
- directory: string;
112
- }
113
- interface CommandOptions {
114
- name: string;
115
- description?: string | null;
116
- usage?: string | null;
117
- info?: string | null;
118
- category?: string | null;
119
- cooldown?: number | null;
120
- ignore?: {
121
- owner?: boolean;
122
- users?: Array<string>;
123
- channels?: Array<string>;
124
- guilds?: Array<string>;
125
- };
126
- strict?: {
127
- owner?: boolean;
128
- users?: Array<string>;
129
- channels?: Array<string>;
130
- guilds?: Array<string>;
131
- };
132
- permissions?: {
133
- user?: Array<PermissionNames> | Array<string>;
134
- client?: Array<PermissionNames> | Array<string>;
135
- dm?: boolean;
136
- };
137
- }
138
- export interface MessageCommandOptions extends CommandOptions {
139
- aliases?: Array<string>;
140
- separator?: string;
141
- prefix?: Array<string> | string;
142
- regex?: RegExp;
143
- channelType?: Array<ChannelType>;
144
- args?: Array<MessageCommandArgumentOptions>;
145
- flags?: Array<MessageCommandFlagOptions>;
146
- }
147
- export interface MessageCommandArgumentOptions {
148
- type: MessageCommandArgumentType;
149
- name: string;
150
- content?: Array<string>;
151
- match?: string | Array<string>;
152
- description?: string;
153
- default?: string | Function;
154
- separator?: string | RegExp;
155
- prompt?: {
156
- reply?: string;
157
- send?: string;
158
- };
159
- }
160
- export interface MessageCommandFlagOptions {
161
- name: string;
162
- match: string;
163
- }
164
- export interface MessageCommandArguments {
165
- args: Record<string, unknown> | null;
166
- flags: Record<string, boolean> | null;
167
- }
168
- export interface SlashCommandOptions extends CommandOptions {
169
- description: string;
170
- nameLocalizations?: Record<Locales, string | null> | null;
171
- descriptionLocalizations?: Record<Locales, string | null> | null;
172
- defer?: {
173
- reply?: boolean;
174
- ephemeral?: boolean;
175
- fetchReply?: boolean;
176
- };
177
- args?: Array<SlashCommandArgumentOptions>;
178
- subcommands?: Array<SlashCommandSubcommandOptions>;
179
- groups?: Array<SlashCommandGroupOptions>;
180
- }
181
- export interface ContextCommandOptions extends CommandOptions {
182
- type: 'user' | 'message';
183
- nameLocalizations?: Record<Locales, string | null> | null;
184
- defer?: {
185
- reply?: boolean;
186
- ephemeral?: boolean;
187
- fetchReply?: boolean;
188
- };
189
- }
190
- export interface SlashCommandArgumentOptions {
191
- type: SlashCommandArgumentType;
192
- name: string;
193
- description: string;
194
- required?: boolean;
195
- autocomplete?: boolean;
196
- choices?: Array<Record<string, string>>;
197
- }
198
- export interface SlashCommandSubcommandOptions {
199
- name: string;
200
- description: string;
201
- args?: Array<SlashCommandArgumentOptions>;
202
- }
203
- export interface SlashCommandGroupOptions {
204
- name: string;
205
- description: string;
206
- subcommands: Array<SlashCommandSubcommandOptions>;
207
- }
208
- export interface SlashCommandArguments {
209
- args: Record<string, string>;
210
- subcommand: Record<string, string>;
211
- group: Record<string, string>;
212
- }
213
- export interface EventBuilderOptions {
214
- name: EventType;
215
- emitter: 'client' | 'process';
216
- type: 'discord';
217
- once: boolean;
218
- }
219
- export interface InhibitorBuilderOptions {
220
- name: string;
221
- type: InhibitorType;
222
- }
223
- export interface PresenceOptions {
224
- text: string;
225
- type?: ActivityType.Playing | ActivityType.Streaming | ActivityType.Listening | ActivityType.Watching | ActivityType.Competing;
226
- url: string;
227
- status?: PresenceStatusData;
228
- interval?: number;
229
- }
230
- export {};
@@ -1,13 +0,0 @@
1
- import { SlashCommandBooleanOption, SlashCommandChannelOption, SlashCommandIntegerOption, SlashCommandMentionableOption, SlashCommandNumberOption, SlashCommandRoleOption, SlashCommandStringOption, SlashCommandUserOption } from 'discord.js';
2
- import { XernerxMessageContextInteraction, XernerxSlashInteraction, XernerxUserContextInteraction } from './extenders.js';
3
- export type FileType = 'MessageCommand' | 'SlashCommand' | 'ContextCommand' | 'Event' | 'Inhibitor';
4
- 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';
5
- export type SlashCommandArgumentType = 'attachment' | 'boolean' | 'channel' | 'integer' | 'mentionable' | 'number' | 'role' | 'string' | 'user';
6
- export type SlashCommandOptionChoices = SlashCommandStringOption | SlashCommandNumberOption | SlashCommandIntegerOption;
7
- export type SlashCommandOption = SlashCommandOptionChoices | SlashCommandBooleanOption | SlashCommandUserOption | SlashCommandChannelOption | SlashCommandRoleOption | SlashCommandMentionableOption;
8
- export type MessageCommandArgumentType = 'string' | 'number' | 'boolean' | 'confirm' | 'channel' | 'guild' | 'integer' | 'mentionable' | 'role' | 'user' | 'message' | 'member' | 'list' | 'option' | 'rest';
9
- export type DiscordEventType = 'applicationCommandPermissionsUpdate' | 'autoModerationActionExecution' | 'autoModerationRuleCreate' | 'autoModerationRuleDelete' | 'autoModerationRuleUpdate' | 'ready' | 'guildCreate' | 'guildDelete' | 'guildUpdate' | 'guildUnavailable' | 'guildMemberAdd' | 'guildMemberRemove' | 'guildMemberUpdate' | 'guildMemberAvailable' | 'guildMembersChunk' | 'guildIntegrationsUpdate' | 'roleCreate' | 'roleDelete' | 'inviteCreate' | 'inviteDelete' | 'roleUpdate' | 'emojiCreate' | 'emojiDelete' | 'emojiUpdate' | 'guildBanAdd' | 'guildBanRemove' | 'channelCreate' | 'channelDelete' | 'channelUpdate' | 'channelPinsUpdate' | 'messageCreate' | 'messageDelete' | 'messageUpdate' | 'messageDeleteBulk' | 'messageReactionAdd' | 'messageReactionRemove' | 'messageReactionRemoveAll' | 'messageReactionRemoveEmoji' | 'threadCreate' | 'threadDelete' | 'threadUpdate' | 'threadListSync' | 'threadMemberUpdate' | 'threadMembersUpdate' | 'userUpdate' | 'presenceUpdate' | 'voiceServerUpdate' | 'voiceStateUpdate' | 'typingStart' | 'webhookUpdate' | 'interactionCreate' | 'error' | 'warn' | 'debug' | 'cacheSweep' | 'shardDisconnect' | 'shardError' | 'shardReconnecting' | 'shardReady' | 'shardResume' | 'invalidated' | 'raw' | 'stageInstanceCreate' | 'stageInstanceUpdate' | 'stageInstanceDelete' | 'stickerCreate' | 'stickerDelete' | 'stickerUpdate' | 'guildScheduledEventCreate' | 'guildScheduledEventUpdate' | 'guildScheduledEventDelete' | 'guildScheduledEventUserAdd' | 'guildScheduledEventUserRemove';
10
- export type EventType = DiscordEventType | 'webhookCreate' | 'webhookError' | 'commandBlock' | 'commandError' | 'commandStart' | 'commandFinish' | 'commandCooldown';
11
- export type XernerxInteraction = XernerxSlashInteraction | XernerxUserContextInteraction | XernerxMessageContextInteraction;
12
- 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';
13
- export type InhibitorType = 'message' | 'interaction' | 'command' | 'channel' | 'user' | 'member' | 'guild' | 'contextCommand' | 'messageCommand' | 'slashCommand';
@@ -1 +0,0 @@
1
- export {};
@@ -1,10 +0,0 @@
1
- import XernerxClient from '../client/XernerxClient.js';
2
- import { PresenceOptions } from '../types/interfaces.js';
3
- import Util from './Util.js';
4
- export default class ClientUtil extends Util {
5
- hasVoted?: Function;
6
- constructor(client: XernerxClient);
7
- setPresence(options: PresenceOptions): import("discord.js").ClientPresence | undefined;
8
- resolveChannel(query: string | Record<string, string>): Promise<import("discord.js").Channel | null>;
9
- resolveGuild(query: string | Record<string, string>): Promise<import("discord.js").Guild | null>;
10
- }
@@ -1,10 +0,0 @@
1
- import { MessagePayload } from 'discord.js';
2
- import XernerxClient from '../client/XernerxClient.js';
3
- import { XernerxInteraction } from '../types/types.js';
4
- import Util from './Util.js';
5
- export default class InteractionUtil extends Util {
6
- private interaction;
7
- constructor(client: XernerxClient, interaction: XernerxInteraction);
8
- reply(content: MessagePayload): Promise<import("discord.js").Message<boolean> | import("discord.js").InteractionResponse<boolean>>;
9
- delay(time: number): Promise<unknown>;
10
- }
@@ -1,15 +0,0 @@
1
- import { MessagePayload, User } from 'discord.js';
2
- import XernerxClient from '../client/XernerxClient.js';
3
- import { XernerxMessage } from '../types/extenders.js';
4
- import Util from './Util.js';
5
- export default class MessageUtil extends Util {
6
- private readonly message;
7
- parsed: {
8
- alias: null | string;
9
- prefix: null | string;
10
- };
11
- constructor(client: XernerxClient, message: XernerxMessage);
12
- reply(content: MessagePayload): Promise<import("discord.js").Message<boolean> | undefined>;
13
- webhookReply(content: MessagePayload, url?: URL, user?: User): Promise<void>;
14
- delay(time: number): Promise<unknown>;
15
- }
@@ -1,5 +0,0 @@
1
- import XernerxClient from '../client/XernerxClient.js';
2
- export default class Util {
3
- client: XernerxClient;
4
- constructor(client: XernerxClient);
5
- }
@@ -1,6 +0,0 @@
1
- import ContextCommandBuilder from '../build/ContextCommandBuilder.js';
2
- import MessageCommandBuilder from '../build/MessageCommandBuilder.js';
3
- import SlashCommandBuilder from '../build/SlashCommandBuilder.js';
4
- import { XernerxMessage } from '../types/extenders.js';
5
- import { XernerxInteraction } from '../types/types.js';
6
- export default function commandValidation(event: XernerxInteraction | XernerxMessage, command: MessageCommandBuilder | SlashCommandBuilder | ContextCommandBuilder): Promise<boolean>;
@@ -1,5 +0,0 @@
1
- import { ContextCommandBuilder, MessageCommandBuilder, SlashCommandBuilder } from '../main.js';
2
- import { XernerxMessage } from '../types/extenders.js';
3
- import { InhibitorType, XernerxInteraction } from '../types/types.js';
4
- export declare function inhibitorValidation(event: XernerxMessage | XernerxInteraction, cmd?: ContextCommandBuilder | MessageCommandBuilder | SlashCommandBuilder): Promise<boolean>;
5
- export declare function inhibitorArguments(event: XernerxMessage | XernerxInteraction, cmd: ContextCommandBuilder | MessageCommandBuilder | SlashCommandBuilder | null, type: InhibitorType): import("discord.js").Guild | import("discord.js").GuildMember | import("discord.js").TextBasedChannel | import("discord.js").User | SlashCommandBuilder | ContextCommandBuilder | MessageCommandBuilder | import("../main.js").APIInteractionGuildMember | null;
@@ -1,34 +0,0 @@
1
- export async function inhibitorValidation(event, cmd) {
2
- const client = event.client;
3
- const inhibits = [];
4
- for (const [name, inhibitor] of client.inhibitors) {
5
- if (Boolean(await inhibitor.check(event, await inhibitorArguments(event, cmd || null, inhibitor.type)))) {
6
- inhibits.push(name);
7
- }
8
- }
9
- return !!inhibits.length;
10
- }
11
- export function inhibitorArguments(event, cmd, type) {
12
- switch (type) {
13
- case 'channel':
14
- return event.channel || null;
15
- case 'command':
16
- return cmd;
17
- case 'contextCommand':
18
- return cmd;
19
- case 'guild':
20
- return event.guild || null;
21
- case 'interaction':
22
- return null;
23
- case 'member':
24
- return event.member || null;
25
- case 'message':
26
- return null;
27
- case 'messageCommand':
28
- return cmd;
29
- case 'slashCommand':
30
- return cmd;
31
- case 'user':
32
- return event.user;
33
- }
34
- }