forked from Galactic/galactic-bot
Silent mode
This commit is contained in:
parent
ccb07ad578
commit
30f0dd8493
@ -184,21 +184,21 @@ 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', {
|
||||
infraction: dictionary.present,
|
||||
targetType: `${targetType.toLowerCase()}${data.targets.length === 1 ? '' : 's'}`,
|
||||
target: data.targets.map((t) => `**${Util.escapeMarkdown(t)}**`).join(' '),
|
||||
reason: data.formatted ? data.reason : invoker.format(data.reason)
|
||||
})}`;
|
||||
(!data.escalation && !success) //eslint-disable-line
|
||||
? string = `${str}\n${string}`
|
||||
: string += str;
|
||||
}
|
||||
}
|
||||
|
||||
for (const [, data] of Object.entries(fails)) {
|
||||
const { dictionary, targetType } = data.infraction;
|
||||
const str = `${Emojis.failure} ${invoker.format('INFRACTION_FAIL', {
|
||||
infraction: dictionary.present,
|
||||
targetType: `${targetType.toLowerCase()}${data.targets.length === 1 ? '' : 's'}`,
|
||||
target: data.targets.map((t) => `**${Util.escapeMarkdown(t)}**`).join(' '),
|
||||
reason: data.formatted ? data.reason : invoker.format(data.reason)
|
||||
})}`;
|
||||
(!data.escalation && !success) //eslint-disable-line
|
||||
? string = `${str}\n${string}`
|
||||
: string += str;
|
||||
}
|
||||
|
||||
if(silent) await invoker.deleteReply();
|
||||
// if (success && silent) { //Delete message if silent.
|
||||
// try {
|
||||
// await interaction.delete();
|
||||
|
@ -105,6 +105,10 @@ class InteractionWrapper {
|
||||
return this.interaction.deferUpdate(...args);
|
||||
}
|
||||
|
||||
deleteReply() {
|
||||
return this.interaction.deleteReply();
|
||||
}
|
||||
|
||||
update(...args) {
|
||||
return this.interaction.update(...args);
|
||||
}
|
||||
|
@ -92,6 +92,10 @@ class InvokerWrapper {
|
||||
return this.target.deferReply(options);
|
||||
}
|
||||
|
||||
deleteReply() {
|
||||
return this.target.deleteReply();
|
||||
}
|
||||
|
||||
async promptMessage(str, opts = {}) {
|
||||
|
||||
if (str instanceof Object) {
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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] });
|
||||
|
@ -33,7 +33,7 @@ class SilentSetting extends Setting {
|
||||
setting[opt.name] = opt.value;
|
||||
}
|
||||
|
||||
return { index: 'SETTING_SUCCESS' };
|
||||
return { index: 'SETTING_SUCCESS_ALT' };
|
||||
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user