xernerx 4.5.29 → 4.6.1

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.
@@ -12,17 +12,21 @@ export default class XernerxContextCommand {
12
12
  readonly info: string | null | undefined;
13
13
  readonly category: string | null | undefined;
14
14
  readonly cooldown: number | null | undefined;
15
+ readonly channel: ("GuildText" | "DM" | "GuildVoice" | "GroupDM" | "GuildCategory" | "GuildAnnouncement" | "AnnouncementThread" | "PublicThread" | "PrivateThread" | "GuildStageVoice" | "GuildDirectory" | "GuildForum" | "GuildNews" | "GuildNewsThread" | "GuildPublicThread" | "GuildPrivateThread")[] | null;
16
+ readonly global: boolean | undefined;
15
17
  readonly ignore: {
16
18
  owner?: boolean | undefined;
17
19
  users?: string[] | undefined;
18
20
  channels?: string[] | undefined;
19
21
  guilds?: string[] | undefined;
22
+ voice?: boolean | undefined;
20
23
  } | undefined;
21
24
  readonly strict: {
22
25
  owner?: boolean | undefined;
23
26
  users?: string[] | undefined;
24
27
  channels?: string[] | undefined;
25
28
  guilds?: string[] | undefined;
29
+ voice?: boolean | undefined;
26
30
  } | undefined;
27
31
  readonly permissions: {
28
32
  user?: string[] | import("../main.js").PermissionNames[] | undefined;
@@ -19,12 +19,53 @@ export default class XernerxContextCommand {
19
19
  info: z.string().or(z.null()).default(null),
20
20
  category: z.string().or(z.null()).default(null),
21
21
  cooldown: z.number().or(z.null()).default(null),
22
+ global: z.boolean().default(true),
23
+ channel: z
24
+ .array(z.enum([
25
+ 'GuildText',
26
+ 'DM',
27
+ 'GuildVoice',
28
+ 'GroupDM',
29
+ 'GuildCategory',
30
+ 'GuildAnnouncement',
31
+ 'AnnouncementThread',
32
+ 'PublicThread',
33
+ 'PrivateThread',
34
+ 'GuildStageVoice',
35
+ 'GuildDirectory',
36
+ 'GuildForum',
37
+ 'GuildNews',
38
+ 'GuildNewsThread',
39
+ 'GuildPublicThread',
40
+ 'GuildPrivateThread',
41
+ ]))
42
+ .or(z.enum([
43
+ 'GuildText',
44
+ 'DM',
45
+ 'GuildVoice',
46
+ 'GroupDM',
47
+ 'GuildCategory',
48
+ 'GuildAnnouncement',
49
+ 'AnnouncementThread',
50
+ 'PublicThread',
51
+ 'PrivateThread',
52
+ 'GuildStageVoice',
53
+ 'GuildDirectory',
54
+ 'GuildForum',
55
+ 'GuildNews',
56
+ 'GuildNewsThread',
57
+ 'GuildPublicThread',
58
+ 'GuildPrivateThread',
59
+ ]))
60
+ .or(z.null())
61
+ .default(null),
22
62
  ignore: z
23
63
  .object({
24
64
  owner: z.boolean().default(false),
25
65
  users: z.array(z.string()).default([]),
26
66
  channels: z.array(z.string()).default([]),
27
67
  guilds: z.array(z.string()).default([]),
68
+ voice: z.boolean().default(false),
28
69
  })
29
70
  .default({}),
30
71
  strict: z
@@ -33,6 +74,7 @@ export default class XernerxContextCommand {
33
74
  users: z.array(z.string()).default([]),
34
75
  channels: z.array(z.string()).default([]),
35
76
  guilds: z.array(z.string()).default([]),
77
+ voice: z.boolean().default(false),
36
78
  })
37
79
  .default({}),
38
80
  permissions: z
@@ -58,6 +100,8 @@ export default class XernerxContextCommand {
58
100
  this.info = options.info;
59
101
  this.category = options.category;
60
102
  this.cooldown = options.cooldown;
103
+ this.channel = options.channel ? (Array.isArray(options.channel) ? options.channel : [options.channel]) : null;
104
+ this.global = options.global;
61
105
  this.ignore = options.ignore;
62
106
  this.strict = options.strict;
63
107
  this.permissions = options.permissions;
@@ -15,17 +15,21 @@ export default class XernerxMessageCommand {
15
15
  readonly flags: import("../main.js").MessageCommandFlagOptions[] | undefined;
16
16
  readonly category: string | null | undefined;
17
17
  readonly cooldown: number | null | undefined;
18
+ readonly channel: ("GuildText" | "DM" | "GuildVoice" | "GroupDM" | "GuildCategory" | "GuildAnnouncement" | "AnnouncementThread" | "PublicThread" | "PrivateThread" | "GuildStageVoice" | "GuildDirectory" | "GuildForum" | "GuildNews" | "GuildNewsThread" | "GuildPublicThread" | "GuildPrivateThread")[] | null;
19
+ readonly global: boolean | undefined;
18
20
  readonly ignore: {
19
21
  owner?: boolean | undefined;
20
22
  users?: string[] | undefined;
21
23
  channels?: string[] | undefined;
22
24
  guilds?: string[] | undefined;
25
+ voice?: boolean | undefined;
23
26
  } | undefined;
24
27
  readonly strict: {
25
28
  owner?: boolean | undefined;
26
29
  users?: string[] | undefined;
27
30
  channels?: string[] | undefined;
28
31
  guilds?: string[] | undefined;
32
+ voice?: boolean | undefined;
29
33
  } | undefined;
30
34
  readonly permissions: {
31
35
  user?: string[] | import("../main.js").PermissionNames[] | undefined;
@@ -16,6 +16,46 @@ export default class XernerxMessageCommand {
16
16
  info: z.string().or(z.null()).default(null),
17
17
  category: z.string().or(z.null()).default(null),
18
18
  cooldown: z.number().or(z.null()).default(null),
19
+ global: z.boolean().default(true),
20
+ channel: z
21
+ .array(z.enum([
22
+ 'GuildText',
23
+ 'DM',
24
+ 'GuildVoice',
25
+ 'GroupDM',
26
+ 'GuildCategory',
27
+ 'GuildAnnouncement',
28
+ 'AnnouncementThread',
29
+ 'PublicThread',
30
+ 'PrivateThread',
31
+ 'GuildStageVoice',
32
+ 'GuildDirectory',
33
+ 'GuildForum',
34
+ 'GuildNews',
35
+ 'GuildNewsThread',
36
+ 'GuildPublicThread',
37
+ 'GuildPrivateThread',
38
+ ]))
39
+ .or(z.enum([
40
+ 'GuildText',
41
+ 'DM',
42
+ 'GuildVoice',
43
+ 'GroupDM',
44
+ 'GuildCategory',
45
+ 'GuildAnnouncement',
46
+ 'AnnouncementThread',
47
+ 'PublicThread',
48
+ 'PrivateThread',
49
+ 'GuildStageVoice',
50
+ 'GuildDirectory',
51
+ 'GuildForum',
52
+ 'GuildNews',
53
+ 'GuildNewsThread',
54
+ 'GuildPublicThread',
55
+ 'GuildPrivateThread',
56
+ ]))
57
+ .or(z.null())
58
+ .default(null),
19
59
  prefix: z.array(z.string()).or(z.string()).default([]),
20
60
  ignore: z
21
61
  .object({
@@ -23,6 +63,7 @@ export default class XernerxMessageCommand {
23
63
  users: z.array(z.string()).default([]),
24
64
  channels: z.array(z.string()).default([]),
25
65
  guilds: z.array(z.string()).default([]),
66
+ voice: z.boolean().default(false),
26
67
  })
27
68
  .default({}),
28
69
  strict: z
@@ -31,6 +72,7 @@ export default class XernerxMessageCommand {
31
72
  users: z.array(z.string()).default([]),
32
73
  channels: z.array(z.string()).default([]),
33
74
  guilds: z.array(z.string()).default([]),
75
+ voice: z.boolean().default(false),
34
76
  })
35
77
  .default({}),
36
78
  permissions: z
@@ -50,6 +92,8 @@ export default class XernerxMessageCommand {
50
92
  this.info = options.info;
51
93
  this.category = options.category;
52
94
  this.cooldown = options.cooldown;
95
+ this.channel = options.channel ? (Array.isArray(options.channel) ? options.channel : [options.channel]) : null;
96
+ this.global = options.global;
53
97
  this.ignore = options.ignore;
54
98
  this.strict = options.strict;
55
99
  this.separator = options.separator;
@@ -12,17 +12,21 @@ export default class XernerxSlashCommand {
12
12
  readonly info: string | null | undefined;
13
13
  readonly category: string | null | undefined;
14
14
  readonly cooldown: number | null | undefined;
15
+ readonly channel: ("GuildText" | "DM" | "GuildVoice" | "GroupDM" | "GuildCategory" | "GuildAnnouncement" | "AnnouncementThread" | "PublicThread" | "PrivateThread" | "GuildStageVoice" | "GuildDirectory" | "GuildForum" | "GuildNews" | "GuildNewsThread" | "GuildPublicThread" | "GuildPrivateThread")[] | null;
16
+ readonly global: boolean | undefined;
15
17
  readonly ignore: {
16
18
  owner?: boolean | undefined;
17
19
  users?: string[] | undefined;
18
20
  channels?: string[] | undefined;
19
21
  guilds?: string[] | undefined;
22
+ voice?: boolean | undefined;
20
23
  } | undefined;
21
24
  readonly strict: {
22
25
  owner?: boolean | undefined;
23
26
  users?: string[] | undefined;
24
27
  channels?: string[] | undefined;
25
28
  guilds?: string[] | undefined;
29
+ voice?: boolean | undefined;
26
30
  } | undefined;
27
31
  readonly permissions: {
28
32
  user?: string[] | import("../main.js").PermissionNames[] | undefined;
@@ -28,13 +28,53 @@ export default class XernerxSlashCommand {
28
28
  info: z.string().or(z.null()).default(null),
29
29
  category: z.string().or(z.null()).default(null),
30
30
  number: z.number().or(z.null()).default(null),
31
- channelType: z.array(z.number()).or(z.null()).default(null),
31
+ global: z.boolean().default(true),
32
+ channel: z
33
+ .array(z.enum([
34
+ 'GuildText',
35
+ 'DM',
36
+ 'GuildVoice',
37
+ 'GroupDM',
38
+ 'GuildCategory',
39
+ 'GuildAnnouncement',
40
+ 'AnnouncementThread',
41
+ 'PublicThread',
42
+ 'PrivateThread',
43
+ 'GuildStageVoice',
44
+ 'GuildDirectory',
45
+ 'GuildForum',
46
+ 'GuildNews',
47
+ 'GuildNewsThread',
48
+ 'GuildPublicThread',
49
+ 'GuildPrivateThread',
50
+ ]))
51
+ .or(z.enum([
52
+ 'GuildText',
53
+ 'DM',
54
+ 'GuildVoice',
55
+ 'GroupDM',
56
+ 'GuildCategory',
57
+ 'GuildAnnouncement',
58
+ 'AnnouncementThread',
59
+ 'PublicThread',
60
+ 'PrivateThread',
61
+ 'GuildStageVoice',
62
+ 'GuildDirectory',
63
+ 'GuildForum',
64
+ 'GuildNews',
65
+ 'GuildNewsThread',
66
+ 'GuildPublicThread',
67
+ 'GuildPrivateThread',
68
+ ]))
69
+ .or(z.null())
70
+ .default(null),
32
71
  ignore: z
33
72
  .object({
34
73
  owner: z.boolean().default(false),
35
74
  users: z.array(z.string()).default([]),
36
75
  channels: z.array(z.string()).default([]),
37
76
  guilds: z.array(z.string()).default([]),
77
+ voice: z.boolean().default(false),
38
78
  })
39
79
  .default({}),
40
80
  strict: z
@@ -43,6 +83,7 @@ export default class XernerxSlashCommand {
43
83
  users: z.array(z.string()).default([]),
44
84
  channels: z.array(z.string()).default([]),
45
85
  guilds: z.array(z.string()).default([]),
86
+ voice: z.boolean().default(false),
46
87
  })
47
88
  .default({}),
48
89
  permissions: z
@@ -67,6 +108,8 @@ export default class XernerxSlashCommand {
67
108
  this.info = options.info;
68
109
  this.category = options.category;
69
110
  this.cooldown = options.cooldown;
111
+ this.channel = options.channel ? (Array.isArray(options.channel) ? options.channel : [options.channel]) : null;
112
+ this.global = options.global;
70
113
  this.ignore = options.ignore;
71
114
  this.strict = options.strict;
72
115
  this.permissions = options.permissions;
@@ -22,9 +22,10 @@ export default class XernerxClient<T = unknown> extends Client {
22
22
  channels: string[];
23
23
  guilds: string[];
24
24
  } | undefined;
25
- log?: {
25
+ log?: boolean | {
26
26
  ready: boolean;
27
27
  error: boolean;
28
+ warn: boolean;
28
29
  info: boolean;
29
30
  table: string[] | null;
30
31
  } | undefined;
@@ -39,9 +39,11 @@ export default class XernerxClient extends Client {
39
39
  .object({
40
40
  ready: z.boolean().default(false),
41
41
  info: z.boolean().default(false),
42
+ warn: z.boolean().default(false),
42
43
  error: z.boolean().default(false),
43
44
  table: z.array(z.string()).or(z.null()).default(null),
44
45
  })
46
+ .or(z.boolean())
45
47
  .optional(),
46
48
  cooldown: z
47
49
  .object({
@@ -3,30 +3,35 @@ import { GatewayVersion, REST, Routes } from 'discord.js';
3
3
  import XernerxLog from '../tools/XernerxLog.js';
4
4
  import XernerxError from '../tools/XernerxError.js';
5
5
  import { Style } from 'dumfunctions';
6
- const commands = [];
6
+ const globalCommands = [];
7
+ const localCommands = [];
7
8
  export default function deploy(client) {
9
+ const commands = [];
8
10
  client.prependOnceListener('ready', (client) => {
11
+ client.commands.slash.map((command) => commands.push(command));
12
+ client.commands.context.map((command) => commands.push(command));
13
+ client.commands.slash.map((command) => commands.push(command));
9
14
  if (client.commands.slash.size)
10
- client.commands.slash.map((command) => commands.push(command.data.toJSON()));
15
+ client.commands.slash.map((command) => (command.global ? globalCommands.push(command.data.toJSON()) : localCommands.push(command.data.toJSON())));
11
16
  if (client.commands.context.size)
12
- client.commands.context.map((command) => commands.push(command.data.toJSON()));
13
- if (commands.length <= 0)
17
+ client.commands.context.map((command) => (command.global ? globalCommands.push(command.data.toJSON()) : localCommands.push(command.data.toJSON())));
18
+ if (globalCommands.length <= 0 && localCommands.length <= 0)
14
19
  return;
15
20
  try {
16
21
  if (client.settings.global) {
17
- put(client, client.settings.global, commands);
18
- put(client, !client.settings.global, []);
22
+ put(client, client.settings.global, globalCommands);
23
+ put(client, !client.settings.global, localCommands);
19
24
  }
20
25
  else {
21
- put(client, !client.settings.global, commands);
26
+ put(client, !client.settings.global, [...globalCommands, ...localCommands]);
22
27
  put(client, client.settings.global, []);
23
28
  }
24
29
  }
25
30
  catch (error) {
26
- new XernerxLog(client).error(`An error occurred while deploying the interaction commands!`, error);
31
+ new XernerxLog(client).error(`An error occurred while deploying the commands!`, error);
27
32
  }
28
33
  finally {
29
- new XernerxLog(client).info(`Deployed ${Style.log(String([client.commands.message.size, client.commands.slash.size, client.commands.context.size].reduce((a, b) => (a += b))), {
34
+ new XernerxLog(client).info(`Deployed ${Style.log(String(commands.filter((command) => command.global).length), {
30
35
  color: Style.TextColor.Cyan,
31
36
  })} Commands ${client.settings.global
32
37
  ? Style.log('globally', { color: Style.TextColor.Green })
@@ -4,11 +4,12 @@ import { ContextHandlerOptions, MessageHandlerOptions, SlashHandlerOptions } fro
4
4
  import Handler from './Handler.js';
5
5
  export default class CommandHandler extends Handler {
6
6
  constructor(client: XernerxClient);
7
- loadMessageCommands(options: MessageHandlerOptions): void;
7
+ loadMessageCommands(options: MessageHandlerOptions): Promise<void>;
8
8
  loadSlashCommands(options: SlashHandlerOptions): void;
9
9
  loadContextCommands(options: ContextHandlerOptions): void;
10
10
  private messageCommandRun;
11
11
  private slashCommandRun;
12
12
  private contextCommandRun;
13
13
  private exec;
14
+ private _checks;
14
15
  }
@@ -15,7 +15,7 @@ export default class CommandHandler extends Handler {
15
15
  constructor(client) {
16
16
  super(client);
17
17
  }
18
- loadMessageCommands(options) {
18
+ async loadMessageCommands(options) {
19
19
  if (!this.client.options.intents.has(GatewayIntentBits.MessageContent))
20
20
  new XernerxLog(this.client).warn(`Message commands might not work as you're missing the intent MessageContent!`);
21
21
  if (!this.client.options.intents.has(GatewayIntentBits.GuildMessages))
@@ -43,7 +43,8 @@ export default class CommandHandler extends Handler {
43
43
  const files = this.readdir(options.directory);
44
44
  for (const file of files) {
45
45
  const filepath = `${path.resolve(options.directory)}\\${file}`;
46
- this.load(filepath, 'MessageCommand');
46
+ const command = await this.load(filepath, 'MessageCommand');
47
+ this._checks(command);
47
48
  }
48
49
  new XernerxLog(this.client).info(`Loaded ${Style.log(String(files.length), { color: Style.TextColor.Cyan })} Message Commands.`);
49
50
  this.emit({
@@ -288,4 +289,12 @@ export default class CommandHandler extends Handler {
288
289
  return await this.client.emit('commandError', event, error, cmd, type);
289
290
  }
290
291
  }
292
+ _checks(command) {
293
+ if ((command.strict?.voice || command.ignore?.voice) && !this.client.options.intents.has('GuildVoiceStates'))
294
+ new XernerxLog(this.client).warn(`${Style.log(command.id, { color: Style.TextColor.Blue })} options ${Style.log(`Xernerx${command.filetype}#strict#voice`, {
295
+ color: Style.BackgroundColor.Grey,
296
+ })} or ${Style.log(`Xernerx${command.filetype}#ignore#voice`, {
297
+ color: Style.BackgroundColor.Grey,
298
+ })} will misbehave due to missing the ${Style.log('GuildVoiceStates', { color: Style.TextColor.Yellow })} intent.`);
299
+ }
291
300
  }
package/dist/main.d.ts CHANGED
@@ -15,6 +15,10 @@ export * from './types/types.js';
15
15
  export * from './types/extenders.js';
16
16
  export * from './types/interfaces.js';
17
17
  import Discord from 'discord.js';
18
+ declare const XernerxIntents: {
19
+ Default: string[];
20
+ All: string[];
21
+ };
18
22
  export default XernerxClient;
19
23
  export {
20
24
  /**
@@ -36,4 +40,4 @@ version,
36
40
  /**
37
41
  ** Tools
38
42
  */
39
- XernerxLog, };
43
+ XernerxLog, XernerxIntents, };
package/dist/main.js CHANGED
@@ -17,6 +17,29 @@ export * from './types/types.js';
17
17
  export * from './types/extenders.js';
18
18
  export * from './types/interfaces.js';
19
19
  import Discord from 'discord.js';
20
+ const XernerxIntents = {
21
+ Default: [
22
+ 'Guilds',
23
+ 'GuildModeration',
24
+ 'GuildBans',
25
+ 'GuildEmojisAndStickers',
26
+ 'GuildIntegrations',
27
+ 'GuildWebhooks',
28
+ 'GuildInvites',
29
+ 'GuildVoiceStates',
30
+ 'GuildMessages',
31
+ 'GuildMessageReactions',
32
+ 'GuildMessageTyping',
33
+ 'DirectMessages',
34
+ 'DirectMessageReactions',
35
+ 'DirectMessageTyping',
36
+ 'GuildScheduledEvents',
37
+ 'AutoModerationConfiguration',
38
+ 'AutoModerationExecution',
39
+ ],
40
+ All: [''],
41
+ };
42
+ XernerxIntents.All = [...XernerxIntents.Default, 'GuildMembers', 'GuildPresences', 'MessageContent'];
20
43
  export default XernerxClient;
21
44
  export {
22
45
  /**
@@ -38,4 +61,4 @@ version,
38
61
  /**
39
62
  ** Tools
40
63
  */
41
- XernerxLog, };
64
+ XernerxLog, XernerxIntents, };
@@ -6,6 +6,7 @@ export default class XernerxLog {
6
6
  private readonly client;
7
7
  private readonly errorLog;
8
8
  private readonly infoLog;
9
+ private readonly warnLog;
9
10
  private readonly readyLog;
10
11
  private readonly tableLog;
11
12
  private readonly time;
@@ -3,13 +3,16 @@ import { Style } from 'dumfunctions';
3
3
  export default class XernerxLog {
4
4
  constructor(client) {
5
5
  this.client = client;
6
- if (client == true) {
6
+ if (client == true || (typeof client.settings.log == 'boolean' && client.settings.log)) {
7
7
  this.errorLog = true;
8
8
  this.infoLog = true;
9
+ this.warnLog = true;
9
10
  }
10
11
  else {
12
+ client.settings.log = client.settings.log;
11
13
  this.errorLog = client.settings.log?.error;
12
14
  this.infoLog = client.settings.log?.info;
15
+ this.warnLog = client.settings.log?.warn;
13
16
  this.readyLog = client.settings.log?.ready;
14
17
  this.tableLog = client.settings.log?.table;
15
18
  }
@@ -19,7 +22,7 @@ export default class XernerxLog {
19
22
  return this.infoLog || force ? console.info(`✔️ | ${Style.log('Xernerx', { color: Style.TextColor.Purple })} | ${Style.log(this.time(), { color: Style.TextColor.Cyan })} | ${message}`) : null;
20
23
  }
21
24
  warn(message) {
22
- return this.infoLog ? console.warn(`⚠️ | ${Style.log('Xernerx', { color: Style.TextColor.Yellow })} | ${Style.log(this.time(), { color: Style.TextColor.Cyan })} | ${message}`) : null;
25
+ return this.warnLog ? console.warn(`⚠️ | ${Style.log('Xernerx', { color: Style.TextColor.Yellow })} | ${Style.log(this.time(), { color: Style.TextColor.Cyan })} | ${message}`) : null;
23
26
  }
24
27
  async update(version, url) {
25
28
  const pkg = await fetch(url)
@@ -42,7 +45,7 @@ export default class XernerxLog {
42
45
  this.client.prependOnceListener('ready', async (synced) => {
43
46
  this.info(`${Style.log(synced.user.tag, { color: Style.TextColor.Blue })} is now ${Style.log('online', { color: Style.TextColor.Green })}, watching ${Style.log(String(client.guilds.cache.size), {
44
47
  color: Style.TextColor.Cyan,
45
- })} guild${client.guilds.cache.size > 1 ? 's' : ''}, using ${client.settings.local ? Style.log((await client.guilds.fetch(client.settings.local)).name, { color: Style.TextColor.Blue }) : 'none'} as local guild.`, this.readyLog);
48
+ })} guild${client.guilds.cache.size > 1 ? 's' : ''}, using ${client.settings.local ? Style.log((await client.guilds.fetch(client.settings.local))?.name, { color: Style.TextColor.Blue }) : 'none'} as local guild.`, this.readyLog);
46
49
  const files = [];
47
50
  for (const [id, data] of client.commands.message) {
48
51
  files.push(data);
@@ -31,6 +31,7 @@ export interface XernerxOptions {
31
31
  log?: {
32
32
  ready?: boolean;
33
33
  info?: boolean;
34
+ warn?: boolean;
34
35
  error?: boolean;
35
36
  table?: Array<'name' | 'aliases' | 'description' | 'filetype' | 'category'>;
36
37
  };
@@ -121,17 +122,21 @@ interface CommandOptions {
121
122
  info?: string | null;
122
123
  category?: string | null;
123
124
  cooldown?: number | null;
125
+ global?: boolean;
126
+ channel?: Array<keyof typeof ChannelType> | keyof typeof ChannelType | null;
124
127
  ignore?: {
125
128
  owner?: boolean;
126
129
  users?: Array<string>;
127
130
  channels?: Array<string>;
128
131
  guilds?: Array<string>;
132
+ voice?: boolean;
129
133
  };
130
134
  strict?: {
131
135
  owner?: boolean;
132
136
  users?: Array<string>;
133
137
  channels?: Array<string>;
134
138
  guilds?: Array<string>;
139
+ voice?: boolean;
135
140
  };
136
141
  permissions?: {
137
142
  user?: Array<PermissionNames> | Array<string>;
@@ -19,12 +19,18 @@ export default async function commandValidation(event, command) {
19
19
  const time = (user?.createdTimestamp || 0) - Number(Date.now());
20
20
  return emit(event, `Command on cooldown, ${time}`);
21
21
  }
22
+ if (command.channel && event.channel?.type !== undefined && event.channel?.type >= 0) {
23
+ if (!command.channel.includes(ChannelType[event.channel?.type]))
24
+ return await emit(event, `Command can only be used in ${command.channel.join(', ')} channels`);
25
+ }
22
26
  if ((command.ignore?.channels?.length || 0) > 0 && command.ignore?.channels?.includes(event.channel?.id))
23
27
  return true;
24
28
  if ((command.ignore?.guilds?.length || 0) > 0 && command.ignore?.guilds?.includes(event.guild?.id))
25
29
  return true;
26
30
  if ((command.ignore?.users?.length || 0) > 0 && command.ignore?.users?.includes(event.user.id))
27
31
  return true;
32
+ if (command.ignore?.voice && event.member?.voice?.channel)
33
+ return await emit(event, 'Command cannot be ran while in voice chat');
28
34
  if (command.strict?.owner && !client.settings.ownerId.includes(event.user.id))
29
35
  return await emit(event, 'Command is a developer command');
30
36
  if ((command.strict?.channels?.length || 0) > 0 && !command.strict?.channels?.includes(event.channel?.id))
@@ -33,12 +39,16 @@ export default async function commandValidation(event, command) {
33
39
  return await emit(event, 'Command cannot be ran in this guild');
34
40
  if ((command.strict?.users?.length || 0) > 0 && !command.strict?.users?.includes(event.user.id))
35
41
  return await emit(event, 'Command cannot be ran by you');
42
+ if (command.strict?.voice && !event.member?.voice?.channel)
43
+ return await emit(event, 'Command cannot be ran while not in voice chat');
36
44
  if (command.permissions?.dm == false && event.channel?.type === ChannelType.DM)
37
45
  return await emit(event, "Can't use in a DM Channel");
38
46
  if (command.permissions?.user) {
39
47
  if (!(event.member?.permissions).has(toBigInt(command.permissions.user)))
40
48
  return await emit(event, 'Missing User Permissions');
41
49
  }
50
+ if ((!command.global || !client.settings.global) && client.settings.local !== event.guild?.id)
51
+ return await emit(event, 'Command is not globally deployed');
42
52
  return false;
43
53
  }
44
54
  async function emit(event, reason) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xernerx",
3
- "version": "4.5.29",
3
+ "version": "4.6.1",
4
4
  "description": "A bot framework for discord.js.",
5
5
  "main": "dist/main.js",
6
6
  "type": "module",
@@ -41,7 +41,7 @@
41
41
  },
42
42
  "dependencies": {
43
43
  "dbl-sdk": "1.2.0",
44
- "discord.js": "14.12.1",
44
+ "discord.js": "14.13.0",
45
45
  "dumfunctions": "2.1.2",
46
46
  "xernerx-extension-builder": "0.0.16",
47
47
  "zod": "3.22.0"