1
0
mirror of https://github.com/toast-ts/Daggerbot-TS.git synced 2024-09-29 04:11:00 -04:00

Cleanup old automod rule

This commit is contained in:
toast-ts 2024-07-17 19:23:45 +10:00
parent c3f6deea3b
commit b040aad719
3 changed files with 5 additions and 38 deletions

View File

@ -36,26 +36,7 @@ export default class Automoderator {
clearTimeout(data.timeout);
data.timeout = setTimeout(()=>delete client.repeatedMessages[message.author.id], thresholdTime);
}
}/*
static isSpam(client:TClient, message:Discord.Message, threshold:number): boolean {
const now = Date.now();
const time = 30000;
if (!client.repeatedMessages[message.author.id]) client.repeatedMessages[message.author.id] = {type: 'spam', count: 1, firstTime: now, timeout: null};
else {
const data = client.repeatedMessages[message.author.id];
if (now - data.firstTime < time) {
data.count++;
if (data.count >= threshold) return true;
} else {
data.count = 1;
data.firstTime = now;
}
clearTimeout(data.timeout);
data.timeout = setTimeout(()=>delete client.repeatedMessages[message.author.id], time);
}
return false;
}*/
static async imageOnly(message:Discord.Message) {
const io_channels = ['468896467688620032'];
let deleteReason:string = 'This is an image-only channel and your message did not contain any images.';

View File

@ -43,17 +43,6 @@ export default class MessageCreate {
await Automoderator.repeatedMessages(client, message, 'mute', 30000, 3, 'bw', '30m', 'Prohibited word spam');
}
},
/*{
name: 'messageSpam',
check: ()=>Automoderator.isSpam(client, message, 6) && !MessageTool.isStaff(message.member as Discord.GuildMember),
action: async()=>{
automodded = true;
message.delete().catch(()=>Logger.console('log', `${automodLog}MessageSpam`, automodFailReason));
message.channel.send('Spamming is not cool, slow down!').then(x=>setTimeout(()=>x.delete(), 15000));
await Automoderator.repeatedMessages(client, message, 'mute', 5000, 2, 'spam', '30m', 'Message spam');
delete client.repeatedMessages[message.author.id];
}
},*/
{
name: 'discordInvite',
check: ()=>message.content.toLowerCase().match(/(https?:\/\/)?(.*?@)?(www\.)?(discord\.(gg)|discord(app)?\.com\/invite)\/(?<code>[\w-]+)/ui) && !MessageTool.isStaff(message.member as Discord.GuildMember),
@ -79,9 +68,6 @@ export default class MessageCreate {
}
};
if (message.guildId === client.config.dcServer.id && !automodded) client.userLevels.messageIncremental(message.author.id);
// Mop gifs from banned channels without admins having to mop them.
// const bannedChannels = []
// if (['tenor.com/view', 'giphy.com/gifs', 'giphy.com/media'].some(e=>message.content.toLowerCase().includes(e)) && bannedChannels.includes(message.channelId)) message.reply('Gifs are not allowed in this channel.').then(()=>message.delete())
// Autoresponse:tm:
if (client.config.botSwitches.autores && !automodded) {

View File

@ -85,10 +85,10 @@ export class MPServerSvc {
async incrementPlayerCount(serverName:string, playerCount:number) {
const server = await this.model.findOne({where: {serverName}});
if (server) {
let PD = server.dataValues.playerData;
if (PD.length > 1920) PD = []; //Selfnote: 86400/45 = 1920, where 86400 is seconds in a day and 45 is the MPModule's refresh interval.
PD.push(playerCount);
await this.model.update({playerData: PD}, {where: {serverName}});
let playerData = server.dataValues.playerData;
if (playerData.length > 1920) playerData = []; //Selfnote: 86400/45 = 1920, where 86400 is seconds in a day and 45 is the MPModule's refresh interval.
playerData.push(playerCount);
await this.model.update({playerData}, {where: {serverName}});
return true;
}
return false;