Silent mode

This commit is contained in:
Erik 2022-07-19 00:35:46 +03:00
parent ccb07ad578
commit 30f0dd8493
Signed by untrusted user: Navy.gif
GPG Key ID: 811EC0CD80E7E5FB
6 changed files with 32 additions and 18 deletions

View File

@ -184,8 +184,6 @@ class ModerationManager {
})}`;
data.escalation ? string += str : string = `${str}\n${string}`; //eslint-disable-line
}
}
for (const [, data] of Object.entries(fails)) {
const { dictionary, targetType } = data.infraction;
const str = `${Emojis.failure} ${invoker.format('INFRACTION_FAIL', {
@ -198,7 +196,9 @@ class ModerationManager {
? string = `${str}\n${string}`
: string += str;
}
}
if(silent) await invoker.deleteReply();
// if (success && silent) { //Delete message if silent.
// try {
// await interaction.delete();

View File

@ -105,6 +105,10 @@ class InteractionWrapper {
return this.interaction.deferUpdate(...args);
}
deleteReply() {
return this.interaction.deleteReply();
}
update(...args) {
return this.interaction.update(...args);
}

View File

@ -92,6 +92,10 @@ class InvokerWrapper {
return this.target.deferReply(options);
}
deleteReply() {
return this.target.deleteReply();
}
async promptMessage(str, opts = {}) {
if (str instanceof Object) {

View File

@ -75,7 +75,7 @@ class MessageWrapper {
}
async reply(options) {
if (this._reply) throw new Error('Message has already been replied to!');
if (this._reply) throw new Error('Message has already been replied to');
if (options.failIfNotExists === undefined) options.failIfNotExists = false; // Creates a non-reply message if the referenced message was deleted
if(!options.allowedMentions) options.allowedMentions = { repliedUser: false }; // Disables the mention in the inline reply
@ -85,10 +85,15 @@ class MessageWrapper {
}
async editReply(options) {
if (!this._reply) throw new Error('Message has not been replied to!');
if (!this._reply) throw new Error('Message not replied to');
return this._reply.edit(options);
}
async deleteReply() {
if (this._reply) return this._reply.delete();
throw new Error('Message not replied to');
}
awaitReactions(...opts) {
return this.message.awaitReactions(...opts);
}

View File

@ -162,7 +162,8 @@ class CommandHandler extends Observer {
return;
}
if (response instanceof Message) return;
// Ignore null responses specifically, should still warn for undefined responses
if (response instanceof Message || response === null) return;
if (response) {
if (response instanceof MessageEmbed) return invoker.reply({ embeds: [response] });

View File

@ -33,7 +33,7 @@ class SilentSetting extends Setting {
setting[opt.name] = opt.value;
}
return { index: 'SETTING_SUCCESS' };
return { index: 'SETTING_SUCCESS_ALT' };
}