Fix escapeMarkdown being passed an array (hopefully)
This commit is contained in:
parent
b9d165d1af
commit
a278987cc2
@ -97,7 +97,7 @@ class MuteCommand extends Command {
|
||||
time = setting.defaultDuration;
|
||||
}
|
||||
} else {
|
||||
reason = reason.slice(1).join(' ');
|
||||
reason = reason.slice(1);
|
||||
}
|
||||
|
||||
if(time !== 0) {
|
||||
@ -110,7 +110,7 @@ class MuteCommand extends Command {
|
||||
.handleInfraction(Mute, message, {
|
||||
targets: parsed,
|
||||
duration: time,
|
||||
reason
|
||||
reason: reason.join(' ')
|
||||
});
|
||||
|
||||
}
|
||||
|
@ -108,7 +108,7 @@ const Guild = Structures.extend('Guild', (Guild) => {
|
||||
|
||||
async _deleteSettings() { //Delete whole entry - remove
|
||||
try {
|
||||
await this.client.storageManager.guilds.deleteOne({ guildId: this.id });
|
||||
await this.client.storageManager.mongodb.guilds.deleteOne({ guildId: this.id });
|
||||
this._settings = { ...{}, ...this.defaultConfig }; //Create a new object so settings that change the _settings value won't replicate it towards the defaultConfig.
|
||||
this._storageLog(`Database Delete (guild:${this.id}).`);
|
||||
} catch(error) {
|
||||
|
@ -20,7 +20,7 @@ const GuildMember = Structures.extend('GuildMember', (GuildMember) => {
|
||||
|
||||
if(filtered.size > 0) return filtered.first();
|
||||
const result = await this.client.storageManager.mongodb.infractions.findOne(
|
||||
{ duration: 0, type, target: this.id },
|
||||
{ duration: { $gt: 0 }, type, target: this.id },
|
||||
{ sort: { timestamp: -1 } }// Finds latest mute.
|
||||
).catch((error) => { //eslint-disable-line no-unused-vars
|
||||
return null;
|
||||
|
@ -410,7 +410,7 @@ class ModerationManager {
|
||||
await new undoClass(this.client, {
|
||||
reason: `AUTO-${Constants.Opposites[i.type]} from Case ${i.case}`,
|
||||
channel: guild.channels.resolve(i.channel),
|
||||
hyperlink: i.logMessage && i.moderationLog ? `https://discord.com/channels/${i.guild}/${i.moderationLog}/${i.logMessage}` : null,
|
||||
hyperlink: i.modLogMessage && i.modLogChannel ? `https://discord.com/channels/${i.guild}/${i.modLogChannel}/${i.modLogMessage}` : null,
|
||||
data: i.data,
|
||||
guild,
|
||||
target,
|
||||
@ -437,8 +437,8 @@ class ModerationManager {
|
||||
this.client.logger.debug(`Going to resolve infraction in: ${expiration-currentDate}`);
|
||||
|
||||
this.callbacks.set(infraction.id, {
|
||||
timeout: setTimeout(() => {
|
||||
resolve(infraction);
|
||||
timeout: setTimeout(async () => {
|
||||
await resolve(infraction);
|
||||
}, expiration-currentDate),
|
||||
infraction
|
||||
});
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* eslint-disable indent */
|
||||
const { Infraction } = require('../interfaces/');
|
||||
|
||||
class MuteInfraction extends Infraction {
|
||||
class UnmuteInfraction extends Infraction {
|
||||
|
||||
constructor(client, opts = {}) {
|
||||
|
||||
@ -45,6 +45,8 @@ class MuteInfraction extends Infraction {
|
||||
removedRoles = mute.infraction.data.removedRoles; //eslint-disable-line prefer-destructuring
|
||||
muteType = mute.infraction.data.muteType; //eslint-disable-line prefer-destructuring
|
||||
role = mute.infraction.data.muteRole; //eslint-disable-line prefer-destructuring
|
||||
} else {
|
||||
role = this.guild._settings.mute.role; //eslint-disable-line prefer-destructuring
|
||||
}
|
||||
}
|
||||
|
||||
@ -102,4 +104,4 @@ class MuteInfraction extends Infraction {
|
||||
|
||||
}
|
||||
|
||||
module.exports = MuteInfraction;
|
||||
module.exports = UnmuteInfraction;
|
@ -71,6 +71,9 @@ class Infraction {
|
||||
|
||||
async handle() {
|
||||
|
||||
//NOTE: Temporary logging, making sure there isn't any other issues.
|
||||
if(typeof this.reason !== 'string') this.client.logger.error(`Infraction type ${this.type} was passed an invalid type to the reason.`);
|
||||
|
||||
const { moderationLog, dmInfraction } = await this.guild.settings();
|
||||
|
||||
//Increment CaseId, should only be called if making a new infraction.
|
||||
@ -206,7 +209,7 @@ class Infraction {
|
||||
reason: this.reason,
|
||||
data: this.data,
|
||||
flags: this.flags,
|
||||
modLogMessage: this.modLogMessageId,
|
||||
modLogMessage: this.modlogMessageId,
|
||||
dmLogMessage: this.dmlogMessageId,
|
||||
modLogChannel: this.modlogId,
|
||||
resolved: this.resolved,
|
||||
|
@ -99,7 +99,7 @@ class Util {
|
||||
}
|
||||
|
||||
static escapeMarkdown(text, options) {
|
||||
console.log(text);
|
||||
if(typeof text !== 'string') return text;
|
||||
return DiscordUtil.escapeMarkdown(text, options);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user