xernerx 4.4.4 → 4.4.5

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.
@@ -1,12 +1,11 @@
1
1
  import { ContextMenuCommandBuilder } from 'discord.js';
2
2
  import XernerxClient from '../client/XernerxClient.js';
3
- import { XernerxMessageContextInteraction, XernerxUserContextInteraction } from '../types/extenders.js';
4
3
  import { ContextCommandOptions } from '../types/interfaces.js';
5
4
  export default class ContextCommandBuilder {
6
5
  readonly id: string;
7
6
  readonly data: ContextMenuCommandBuilder;
8
7
  readonly name: string;
9
- readonly type: 'message' | 'user';
8
+ readonly type: 'user' | 'message';
10
9
  readonly description: string | null | undefined;
11
10
  readonly usage: string | null | undefined;
12
11
  readonly info: string | null | undefined;
@@ -42,7 +41,9 @@ export default class ContextCommandBuilder {
42
41
  fetchReply?: boolean | undefined;
43
42
  }
44
43
  | undefined;
44
+ readonly fileType: 'ContextCommand';
45
+ readonly filePath: string;
45
46
  readonly client: typeof XernerxClient;
46
47
  constructor(id: string, options: ContextCommandOptions);
47
- exec(interaction: XernerxUserContextInteraction | XernerxMessageContextInteraction): Promise<void>;
48
+ exec(): Promise<void>;
48
49
  }
@@ -63,5 +63,5 @@ export default class ContextCommandBuilder {
63
63
  this.defer = options.defer;
64
64
  this.client = XernerxClient;
65
65
  }
66
- async exec(interaction) {}
66
+ async exec() {}
67
67
  }
@@ -12,11 +12,13 @@ export default class EventBuilder {
12
12
  readonly emitter?: 'client' | 'process' | string;
13
13
  readonly type?: 'discord' | string;
14
14
  readonly once?: boolean;
15
+ readonly fileType: 'Event';
16
+ readonly filePath: string;
15
17
  readonly client: typeof XernerxClient;
16
18
  constructor(id: string, options: EventBuilderOptions);
17
19
  /**
18
20
  * @description run your custom event here.
19
21
  * TODO - update description
20
22
  */
21
- run<T>(...args: T[]): Promise<void>;
23
+ run(): Promise<void>;
22
24
  }
@@ -25,5 +25,5 @@ export default class EventBuilder {
25
25
  * @description run your custom event here.
26
26
  * TODO - update description
27
27
  */
28
- async run(...args) {}
28
+ async run() {}
29
29
  }
@@ -1,7 +1,7 @@
1
1
  import XernerxClient from '../client/XernerxClient.js';
2
2
  import { InhibitorBuilderOptions } from '../types/interfaces.js';
3
- import { InhibitorType, XernerxInteraction } from '../types/types.js';
4
- import { XernerxMessage } from '../types/extenders.js';
3
+ import { InhibitorType } from '../types/types.js';
4
+ import { XernerxMessage, XernerxMessageContextInteraction, XernerxSlashInteraction, XernerxUserContextInteraction } from '../types/extenders.js';
5
5
  /**
6
6
  * @description - The inhibitor builder for inhibitors.
7
7
  * @param {String} id - The unique ID of the inhibitor.
@@ -11,7 +11,9 @@ export default class InhibitorBuilder {
11
11
  readonly id: string;
12
12
  readonly name: string;
13
13
  readonly type: InhibitorType;
14
+ readonly fileType: 'Inhibitor';
15
+ readonly filePath: string;
14
16
  readonly client: typeof XernerxClient;
15
17
  constructor(id: string, options: InhibitorBuilderOptions);
16
- check<T>(action: XernerxInteraction | XernerxMessage, args: T): Promise<void>;
18
+ check(interaction: XernerxMessage | XernerxSlashInteraction | XernerxUserContextInteraction | XernerxMessageContextInteraction, args: any): Promise<void>;
17
19
  }
@@ -18,5 +18,5 @@ export default class InhibitorBuilder {
18
18
  this.type = options.type;
19
19
  this.client = XernerxClient;
20
20
  }
21
- async check(action, args) {}
21
+ async check(interaction, args) {}
22
22
  }
@@ -1,6 +1,6 @@
1
1
  import XernerxClient from '../client/XernerxClient.js';
2
2
  import { XernerxMessage } from '../types/extenders.js';
3
- import { MessageCommandArguments, MessageCommandOptions } from '../types/interfaces.js';
3
+ import { MessageCommandOptions } from '../types/interfaces.js';
4
4
  export default class MessageCommandBuilder {
5
5
  readonly id: string;
6
6
  readonly name: string;
@@ -38,8 +38,10 @@ export default class MessageCommandBuilder {
38
38
  dm?: boolean | undefined;
39
39
  }
40
40
  | undefined;
41
+ readonly fileType: 'MessageCommand';
42
+ readonly filePath: string;
41
43
  readonly client: typeof XernerxClient;
42
44
  constructor(id: string, options: MessageCommandOptions);
43
- conditions(message: XernerxMessage, args: MessageCommandArguments): Promise<void>;
44
- exec(message: XernerxMessage, args: MessageCommandArguments): Promise<void>;
45
+ conditions(message: XernerxMessage, { args, flags }: any): Promise<void>;
46
+ exec(message: XernerxMessage, { args, flags }: any): Promise<void>;
45
47
  }
@@ -55,6 +55,6 @@ export default class MessageCommandBuilder {
55
55
  this.permissions = options.permissions;
56
56
  this.client = XernerxClient;
57
57
  }
58
- async conditions(message, args) {}
59
- async exec(message, args) {}
58
+ async conditions(message, { args, flags }) {}
59
+ async exec(message, { args, flags }) {}
60
60
  }
@@ -1,7 +1,8 @@
1
1
  import Discord from 'discord.js';
2
2
  import XernerxClient from '../client/XernerxClient.js';
3
3
  import { XernerxSlashInteraction } from '../types/extenders.js';
4
- import { SlashCommandArguments, SlashCommandOptions } from '../types/interfaces.js';
4
+ import { SlashCommandOptions } from '../types/interfaces.js';
5
+ import { XernerxInteraction } from '../types/types.js';
5
6
  export default class SlashCommandBuilder {
6
7
  readonly id: string;
7
8
  readonly data: Discord.SlashCommandBuilder;
@@ -41,11 +42,13 @@ export default class SlashCommandBuilder {
41
42
  fetchReply?: boolean | undefined;
42
43
  }
43
44
  | undefined;
45
+ readonly fileType: 'SlashCommand';
46
+ readonly filePath: string;
44
47
  readonly client: typeof XernerxClient;
45
48
  constructor(id: string, options: SlashCommandOptions);
46
- autocomplete<T>(interaction: XernerxSlashInteraction, focused: T, options: Array<T>): Promise<void>;
47
- conditions(interaction: XernerxSlashInteraction, args: SlashCommandArguments): Promise<void>;
48
- exec(interaction: XernerxSlashInteraction, args: SlashCommandArguments): Promise<void>;
49
+ autocomplete<T>(interaction: XernerxInteraction, focused: T, options: T[]): Promise<void>;
50
+ conditions(interaction: XernerxSlashInteraction, { args, subcommand, group }: any): Promise<void>;
51
+ exec(interaction: XernerxSlashInteraction, { args, subcommand, group }: any): Promise<void>;
49
52
  private addArguments;
50
53
  private addSubcommands;
51
54
  private addSubcommandGroups;
@@ -73,8 +73,8 @@ export default class SlashCommandBuilder {
73
73
  this.client = XernerxClient;
74
74
  }
75
75
  async autocomplete(interaction, focused, options) {}
76
- async conditions(interaction, args) {}
77
- async exec(interaction, args) {}
76
+ async conditions(interaction, { args, subcommand, group }) {}
77
+ async exec(interaction, { args, subcommand, group }) {}
78
78
  addArguments(command, args) {
79
79
  for (const argument of args) {
80
80
  let slashCommandArgumentType = `${argument.type.charAt(0).toUpperCase()}${argument.type.slice(1).toLowerCase()}`;
@@ -5,11 +5,4 @@ import { XernerxMessage } from '../types/extenders.js';
5
5
  import { MessageCommandArguments } from '../types/interfaces.js';
6
6
  import { XernerxInteraction } from '../types/types.js';
7
7
  export declare function messageArguments(message: XernerxMessage, command: MessageCommandBuilder): Promise<MessageCommandArguments>;
8
- export declare function interactionArguments(
9
- interaction: XernerxInteraction | any,
10
- command: ContextCommandBuilder | SlashCommandBuilder
11
- ): Promise<{
12
- args: any;
13
- group: any;
14
- subcommand: any;
15
- }>;
8
+ export declare function interactionArguments(interaction: XernerxInteraction | any, command: ContextCommandBuilder | SlashCommandBuilder): Promise<any>;
@@ -115,15 +115,21 @@ export async function messageArguments(message, command) {
115
115
  return { args, flags };
116
116
  }
117
117
  export async function interactionArguments(interaction, command) {
118
- const options = {};
119
- let args = interaction?.options?._hoistedOptions,
120
- group = interaction?.options?._group,
121
- subcommand = interaction?.options?._subcommand;
122
- if (interaction.options._hoistedOptions) {
123
- for (const option of interaction.options._hoistedOptions) {
124
- options[option.name] = option.member || option.channel || option.user || option.role || option.value;
118
+ if (command.fileType === 'SlashCommand') {
119
+ const options = {};
120
+ let args = interaction?.options?._hoistedOptions,
121
+ group = interaction?.options?._group,
122
+ subcommand = interaction?.options?._subcommand;
123
+ if (interaction.options._hoistedOptions) {
124
+ for (const option of interaction.options._hoistedOptions) {
125
+ options[option.name] = option.member || option.channel || option.user || option.role || option.value;
126
+ }
127
+ args = options;
125
128
  }
126
- args = options;
129
+ return { args, group, subcommand };
130
+ }
131
+ if (command.fileType === 'ContextCommand') {
132
+ if (command.type === 'user') return await interaction.client.users.fetch(interaction.targetId);
133
+ if (command.type === 'message') return await interaction.channel.messages.fetch(interaction.targetId);
127
134
  }
128
- return { args, group, subcommand };
129
135
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xernerx",
3
- "version": "4.4.4",
3
+ "version": "4.4.5",
4
4
  "description": "A bot framework for discord.js.",
5
5
  "main": "dist/main.js",
6
6
  "type": "module",