mirror of
https://github.com/toast-ts/Daggerbot-TS.git
synced 2024-11-18 00:31:00 -05:00
Change Advertisement rule to ban from mute
This commit is contained in:
parent
5106f0e849
commit
3e1a441ee4
@ -4,7 +4,7 @@ import Logger from '../helpers/Logger.js';
|
|||||||
export default class Automoderator {
|
export default class Automoderator {
|
||||||
private static lockQuery:Set<Discord.Snowflake> = new Set();
|
private static lockQuery:Set<Discord.Snowflake> = new Set();
|
||||||
static scanMsg =(message:Discord.Message)=>message.content.toLowerCase().replaceAll(/[!@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?\n?0-9]|[]|ing\b/g, '').split(' ').join('');
|
static scanMsg =(message:Discord.Message)=>message.content.toLowerCase().replaceAll(/[!@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?\n?0-9]|[]|ing\b/g, '').split(' ').join('');
|
||||||
static async repeatedMessages(client:TClient, message:Discord.Message, thresholdTime:number, thresholdAmount:number, type:string, duration:string, reason:string) {
|
static async repeatedMessages(client:TClient, message:Discord.Message, action:'mute'|'ban', thresholdTime:number, thresholdAmount:number, type:string, duration:string, reason:string) {
|
||||||
const now = Date.now();
|
const now = Date.now();
|
||||||
|
|
||||||
if (!client.repeatedMessages[message.author.id]) client.repeatedMessages[message.author.id] = {type: type, count:1, firstTime:now, timeout: null};
|
if (!client.repeatedMessages[message.author.id]) client.repeatedMessages[message.author.id] = {type: type, count:1, firstTime:now, timeout: null};
|
||||||
@ -18,7 +18,7 @@ export default class Automoderator {
|
|||||||
if (!this.lockQuery.has(message.author.id)) {
|
if (!this.lockQuery.has(message.author.id)) {
|
||||||
this.lockQuery.add(message.author.id);
|
this.lockQuery.add(message.author.id);
|
||||||
Logger.console('log', 'AUTOMOD', `Lock acquired for ${message.author.tag} with reason: ${reason}`);
|
Logger.console('log', 'AUTOMOD', `Lock acquired for ${message.author.tag} with reason: ${reason}`);
|
||||||
await client.punishments.punishmentAdd('mute', {time: duration}, client.user.id, `AUTOMOD:${reason}`, message.author, message.member as Discord.GuildMember);
|
await client.punishments.punishmentAdd(action, {time: duration}, client.user.id, `AUTOMOD:${reason}`, message.author, message.member as Discord.GuildMember);
|
||||||
setTimeout(()=>{
|
setTimeout(()=>{
|
||||||
this.lockQuery.delete(message.author.id);
|
this.lockQuery.delete(message.author.id);
|
||||||
Logger.console('log', 'AUTOMOD', `Lock released for ${message.author.tag}`);
|
Logger.console('log', 'AUTOMOD', `Lock released for ${message.author.tag}`);
|
||||||
|
@ -21,7 +21,7 @@ export default class MessageCreate {
|
|||||||
automodded = true;
|
automodded = true;
|
||||||
message.delete().catch(()=>Logger.console('log', 'AUTOMOD:PROHIBITEDWORDS', automodFailReason));
|
message.delete().catch(()=>Logger.console('log', 'AUTOMOD:PROHIBITEDWORDS', automodFailReason));
|
||||||
message.channel.send('That word isn\'t allowed here.').then(x=>setTimeout(()=>x.delete(), 10000));
|
message.channel.send('That word isn\'t allowed here.').then(x=>setTimeout(()=>x.delete(), 10000));
|
||||||
await Automoderator.repeatedMessages(client, message, 30000, 3, 'bw', '30m', 'Prohibited word spam');
|
await Automoderator.repeatedMessages(client, message, 'mute', 30000, 3, 'bw', '30m', 'Prohibited word spam');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
discordInvite: {
|
discordInvite: {
|
||||||
@ -32,7 +32,7 @@ export default class MessageCreate {
|
|||||||
automodded = true;
|
automodded = true;
|
||||||
message.delete().catch(()=>Logger.console('log', 'AUTOMOD:ADVERTISEMENT', automodFailReason));
|
message.delete().catch(()=>Logger.console('log', 'AUTOMOD:ADVERTISEMENT', automodFailReason));
|
||||||
message.channel.send('Please don\'t advertise other Discord servers.').then(x=>setTimeout(()=>x.delete(), 15000));
|
message.channel.send('Please don\'t advertise other Discord servers.').then(x=>setTimeout(()=>x.delete(), 15000));
|
||||||
await Automoderator.repeatedMessages(client, message, 60000, 2, 'adv', '1h', 'Discord advertisement');
|
await Automoderator.repeatedMessages(client, message, 'ban', 60000, 4, 'adv', null, 'Discord advertisement');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user