mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-03-15 05:41:51 +00:00
Add log url to automatic spam mute cases
This commit is contained in:
parent
c27f60ba28
commit
ef61eae2ec
1 changed files with 12 additions and 6 deletions
|
@ -5,7 +5,8 @@ import {
|
||||||
getRoleMentions,
|
getRoleMentions,
|
||||||
getUrlsInString,
|
getUrlsInString,
|
||||||
getUserMentions,
|
getUserMentions,
|
||||||
stripObjectToScalars
|
stripObjectToScalars,
|
||||||
|
trimLines
|
||||||
} from "../utils";
|
} from "../utils";
|
||||||
import { LogType } from "../data/LogType";
|
import { LogType } from "../data/LogType";
|
||||||
import { GuildLogs } from "../data/GuildLogs";
|
import { GuildLogs } from "../data/GuildLogs";
|
||||||
|
@ -145,12 +146,12 @@ export class SpamPlugin extends Plugin {
|
||||||
);
|
);
|
||||||
|
|
||||||
if (recentActionsCount > spamConfig.count) {
|
if (recentActionsCount > spamConfig.count) {
|
||||||
if (spamConfig.clean !== false) {
|
const recentActions = this.getRecentActions(type, msg.author.id, msg.channel.id, since);
|
||||||
const recentActions = this.getRecentActions(type, msg.author.id, msg.channel.id, since);
|
const logUrl = await this.saveSpamLogs(recentActions.map(a => a.msg));
|
||||||
const msgIds = recentActions.map(a => a.msg.id);
|
|
||||||
|
|
||||||
|
if (spamConfig.clean !== false) {
|
||||||
|
const msgIds = recentActions.map(a => a.msg.id);
|
||||||
await this.bot.deleteMessages(msg.channel.id, msgIds);
|
await this.bot.deleteMessages(msg.channel.id, msgIds);
|
||||||
const logUrl = await this.saveSpamLogs(recentActions.map(a => a.msg));
|
|
||||||
|
|
||||||
this.logs.log(LogType.SPAM_DELETE, {
|
this.logs.log(LogType.SPAM_DELETE, {
|
||||||
member: stripObjectToScalars(msg.member, ["user"]),
|
member: stripObjectToScalars(msg.member, ["user"]),
|
||||||
|
@ -180,7 +181,12 @@ export class SpamPlugin extends Plugin {
|
||||||
this.bot.user.id,
|
this.bot.user.id,
|
||||||
CaseType.Mute,
|
CaseType.Mute,
|
||||||
null,
|
null,
|
||||||
"Automatic spam detection",
|
trimLines(`
|
||||||
|
Automatic spam detection: ${description} (over ${spamConfig.count} in ${
|
||||||
|
spamConfig.interval
|
||||||
|
}s)
|
||||||
|
${logUrl}
|
||||||
|
`),
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
this.logs.log(LogType.MEMBER_MUTE_SPAM, {
|
this.logs.log(LogType.MEMBER_MUTE_SPAM, {
|
||||||
|
|
Loading…
Add table
Reference in a new issue