xernerx 4.15.1 → 4.15.3
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.
|
@@ -65,6 +65,18 @@ export default class CommandHandler extends Handler {
|
|
|
65
65
|
filetype: 'MessageCommand',
|
|
66
66
|
run: (message) => this.messageCommandRun(message, 'delete'),
|
|
67
67
|
});
|
|
68
|
+
this.client.on('messageReactionAdd', (message) => {
|
|
69
|
+
message.util = new MessageUtil(this.client, message);
|
|
70
|
+
});
|
|
71
|
+
this.client.on('messageReactionRemove', (message) => {
|
|
72
|
+
message.util = new MessageUtil(this.client, message);
|
|
73
|
+
});
|
|
74
|
+
this.client.on('messageReactionRemoveAll', (message) => {
|
|
75
|
+
message.util = new MessageUtil(this.client, message);
|
|
76
|
+
});
|
|
77
|
+
this.client.on('messageReactionRemoveEmoji', (message) => {
|
|
78
|
+
message.util = new MessageUtil(this.client, message);
|
|
79
|
+
});
|
|
68
80
|
}
|
|
69
81
|
// public reloadMessageCommands() {
|
|
70
82
|
// return reload(this.client, 'message');
|
|
@@ -20,6 +20,6 @@ export default class InteractionUtil extends Util {
|
|
|
20
20
|
mimic(user: XernerxUser | string, interaction: MessageCreateOptions, options: MimicOptions): Promise<void>;
|
|
21
21
|
paginator(embeds: Array<EmbedBuilder>, options?: PaginatorOptions): Promise<void | import("discord.js").Message<false> | import("discord.js").Message<true>>;
|
|
22
22
|
commands(): import("@discordjs/collection").Collection<string, import("../main.js").XernerxSlashCommand> | import("@discordjs/collection").Collection<string, import("../main.js").XernerxContextCommand>;
|
|
23
|
-
permissionCheck(type: 'user' | 'client', permissions: Array<PermissionNames
|
|
23
|
+
permissionCheck(type: 'user' | 'client', permissions: Array<PermissionNames>, emit?: boolean): boolean | string[];
|
|
24
24
|
}
|
|
25
25
|
export {};
|
|
@@ -125,8 +125,7 @@ export default class InteractionUtil extends Util {
|
|
|
125
125
|
else
|
|
126
126
|
return this.client.commands.context;
|
|
127
127
|
}
|
|
128
|
-
permissionCheck(type, permissions) {
|
|
129
|
-
console.log(type);
|
|
128
|
+
permissionCheck(type, permissions, emit = true) {
|
|
130
129
|
const missing = [];
|
|
131
130
|
for (const permission of permissions) {
|
|
132
131
|
if (type == 'user') {
|
|
@@ -137,8 +136,7 @@ export default class InteractionUtil extends Util {
|
|
|
137
136
|
}
|
|
138
137
|
}
|
|
139
138
|
const command = this.commands().toJSON().find((cmd) => cmd.name == this.parsed.alias?.split(/ +/)[0]);
|
|
140
|
-
|
|
141
|
-
if (missing.length) {
|
|
139
|
+
if (missing.length && emit) {
|
|
142
140
|
this.client.emit(`commandBlock`, this.interaction, {
|
|
143
141
|
reason: `missing${Style.pascalCase(type)}Permissions`,
|
|
144
142
|
message: `${type == 'user' ? 'You are' : 'I am'} missing the following permissions to run \`${command?.name}\`:\n${missing.map((permission) => `> - ${permission}`).join('\n')}`,
|
|
@@ -147,6 +145,8 @@ export default class InteractionUtil extends Util {
|
|
|
147
145
|
}, command || null);
|
|
148
146
|
return false;
|
|
149
147
|
}
|
|
148
|
+
else if (missing.length && !emit)
|
|
149
|
+
return missing;
|
|
150
150
|
else
|
|
151
151
|
return true;
|
|
152
152
|
}
|
|
@@ -21,6 +21,6 @@ export default class MessageUtil extends Util {
|
|
|
21
21
|
mimic(user: XernerxUser | string, message: MessageCreateOptions, options: MimicOptions): Promise<void>;
|
|
22
22
|
paginator(embeds: Array<EmbedBuilder>, options?: PaginatorOptions): Promise<void | import("discord.js").Message<boolean> | null>;
|
|
23
23
|
commands(): import("@discordjs/collection").Collection<string, import("../main.js").XernerxMessageCommand>;
|
|
24
|
-
permissionCheck(type: 'user' | 'client', permissions: Array<PermissionNames
|
|
24
|
+
permissionCheck(type: 'user' | 'client', permissions: Array<PermissionNames>, emit?: boolean): boolean | string[];
|
|
25
25
|
}
|
|
26
26
|
export {};
|
|
@@ -139,8 +139,7 @@ export default class MessageUtil extends Util {
|
|
|
139
139
|
commands() {
|
|
140
140
|
return this.client.commands.message;
|
|
141
141
|
}
|
|
142
|
-
permissionCheck(type, permissions) {
|
|
143
|
-
console.log(type);
|
|
142
|
+
permissionCheck(type, permissions, emit = true) {
|
|
144
143
|
const missing = [];
|
|
145
144
|
for (const permission of permissions) {
|
|
146
145
|
if (type == 'user') {
|
|
@@ -151,8 +150,7 @@ export default class MessageUtil extends Util {
|
|
|
151
150
|
}
|
|
152
151
|
}
|
|
153
152
|
const command = this.commands().find((cmd) => cmd.name == this.parsed.alias || cmd.aliases?.includes(this.parsed.alias));
|
|
154
|
-
|
|
155
|
-
if (missing.length) {
|
|
153
|
+
if (missing.length && emit) {
|
|
156
154
|
this.client.emit(`commandBlock`, this.message, {
|
|
157
155
|
reason: `missing${Style.pascalCase(type)}Permissions`,
|
|
158
156
|
message: `${type == 'user' ? 'You are' : 'I am'} missing the following permissions to run \`${command?.name}\`:\n${missing.map((permission) => `> - ${permission}`).join('\n')}`,
|
|
@@ -161,6 +159,8 @@ export default class MessageUtil extends Util {
|
|
|
161
159
|
}, command || null);
|
|
162
160
|
return false;
|
|
163
161
|
}
|
|
162
|
+
else if (missing.length && !emit)
|
|
163
|
+
return missing;
|
|
164
164
|
else
|
|
165
165
|
return true;
|
|
166
166
|
}
|