This commit is contained in:
Erik 2022-07-24 01:45:01 +03:00
parent 08ea03ccbf
commit 29aebdf22e
Signed by untrusted user: Navy.gif
GPG Key ID: 811EC0CD80E7E5FB

View File

@ -24,13 +24,17 @@ class CommandHandler extends Observer {
async messageCreate(message) { async messageCreate(message) {
console.log(message.content);
if(!this.client._built if(!this.client._built
|| message.webhookId || message.webhookId
|| message.author.bot || message.author.bot
|| message.guild && !message.guild.available) return undefined; || message.guild && !message.guild.available) return undefined;
console.log(1);
const userWrapper = await this.client.getUserWrapper(message.author.id); const userWrapper = await this.client.getUserWrapper(message.author.id);
if (!userWrapper.developer) return; if (!userWrapper.developer) return;
console.log(2);
if(message.guild) { if(message.guild) {
if(!message.member) await message.guild.members.fetch(message.author.id); if(!message.member) await message.guild.members.fetch(message.author.id);
@ -40,6 +44,7 @@ class CommandHandler extends Observer {
const { command, parameters } = await this._getCommand(messageWrapper); const { command, parameters } = await this._getCommand(messageWrapper);
if (!command) return undefined; if (!command) return undefined;
console.log(3);
const invoker = new InvokerWrapper(this.client, messageWrapper, command); const invoker = new InvokerWrapper(this.client, messageWrapper, command);
const inhibitors = await this._handleInhibitors(invoker); const inhibitors = await this._handleInhibitors(invoker);
@ -48,15 +53,17 @@ class CommandHandler extends Observer {
if (silent.length && silent.some((i) => i.inhibitor.id === 'channelIgnore') if (silent.length && silent.some((i) => i.inhibitor.id === 'channelIgnore')
|| nonsilent.length && nonsilent.some((i) => i.args.missing.includes('SendMessages')) || nonsilent.length && nonsilent.some((i) => i.args.missing.includes('SendMessages'))
|| silent.length && !nonsilent.length) return; || silent.length && !nonsilent.length) return;
console.log(4);
if (inhibitors.length) return this._generateError(invoker, { type: 'inhibitor', ...inhibitors[0] }).catch(this.logger.error); if (inhibitors.length) return this._generateError(invoker, { type: 'inhibitor', ...inhibitors[0] }).catch(this.logger.error);
console.log(5);
const response = await this._parseMessage(invoker, parameters); const response = await this._parseMessage(invoker, parameters);
// There was an error if _parseResponse return value is truthy, i.e. an error message was sent // There was an error if _parseResponse return value is truthy, i.e. an error message was sent
if (await this._parseResponse(invoker, response)) return; if (await this._parseResponse(invoker, response)) return;
console.log(6);
// Temp setup await this._executeCommand(invoker, command.slash ? response.options.args : response.options);
this._executeCommand(invoker, command.slash ? response.options.args : response.options);
} }