This commit is contained in:
Erik 2022-10-10 10:52:12 +03:00
parent ea676845dc
commit 2af1622892
Signed by untrusted user: Navy.gif
GPG Key ID: 811EC0CD80E7E5FB
3 changed files with 6 additions and 2 deletions

View File

@ -519,7 +519,7 @@ module.exports = class AutoModeration extends Observer {
filterResult.filter = 'link'; filterResult.filter = 'link';
if (!silent && perms?.has('SendMessages')) { if (!silent && perms?.has('SendMessages')) {
const res = await this.client.rateLimiter.limitSend(msg.channel, wrapper.format('L_FILTER_DELETE', { user: author.id }), undefined, 'linkFilter'); const res = await this.client.rateLimiter.limitSend(channel, wrapper.format('L_FILTER_DELETE', { user: author.id }), undefined, 'linkFilter');
//const res = await msg.formattedRespond(`L_FILTER_DELETE`, { params: { user: author.id } }); //const res = await msg.formattedRespond(`L_FILTER_DELETE`, { params: { user: author.id } });
//if (res) res.delete({ timeout: 10000 }); //if (res) res.delete({ timeout: 10000 });
setTimeout(() => { setTimeout(() => {

View File

@ -597,7 +597,7 @@ class GuildLogger extends Observer {
if (img.height && img.width) embed.image = { url: img.url }; if (img.height && img.width) embed.image = { url: img.url };
} }
await hook.send({ embeds: [embed] }).catch(this.logger.error); await hook.send({ embeds: [embed] }).catch(this.logger.error.bind(this.logger));
} else { } else {
@ -677,6 +677,7 @@ class GuildLogger extends Observer {
await hook.send({ embeds: [embed] }).catch((err) => { await hook.send({ embeds: [embed] }).catch((err) => {
this.logger.error('Error in message edit:\n' + err.stack + `\n${inspect(embed)}`); this.logger.error('Error in message edit:\n' + err.stack + `\n${inspect(embed)}`);
if (err.code === 10015) wrapper.updateWebhook('messages');
}); });
} }

View File

@ -92,6 +92,9 @@ class MessageLog extends Setting {
}; };
let hook = await guild.getWebhook(this.name); let hook = await guild.getWebhook(this.name);
// Ensure the webhook actually exists
hook = await this.client.fetchWebhook(hook.id).catch(() => null);
if (hook) await hook.edit({ channel }); if (hook) await hook.edit({ channel });
else { else {
hook = await channel.createWebhook({ hook = await channel.createWebhook({