mirror of
https://github.com/toast-ts/Daggerbot-TS.git
synced 2024-11-17 00:10:58 -05:00
Cleanup old automod rule
This commit is contained in:
parent
c3f6deea3b
commit
b040aad719
@ -36,26 +36,7 @@ export default class Automoderator {
|
|||||||
clearTimeout(data.timeout);
|
clearTimeout(data.timeout);
|
||||||
data.timeout = setTimeout(()=>delete client.repeatedMessages[message.author.id], thresholdTime);
|
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) {
|
static async imageOnly(message:Discord.Message) {
|
||||||
const io_channels = ['468896467688620032'];
|
const io_channels = ['468896467688620032'];
|
||||||
let deleteReason:string = 'This is an image-only channel and your message did not contain any images.';
|
let deleteReason:string = 'This is an image-only channel and your message did not contain any images.';
|
||||||
|
@ -43,17 +43,6 @@ export default class MessageCreate {
|
|||||||
await Automoderator.repeatedMessages(client, message, 'mute', 30000, 3, 'bw', '30m', 'Prohibited word spam');
|
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',
|
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),
|
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);
|
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:
|
// Autoresponse:tm:
|
||||||
if (client.config.botSwitches.autores && !automodded) {
|
if (client.config.botSwitches.autores && !automodded) {
|
||||||
|
@ -85,10 +85,10 @@ export class MPServerSvc {
|
|||||||
async incrementPlayerCount(serverName:string, playerCount:number) {
|
async incrementPlayerCount(serverName:string, playerCount:number) {
|
||||||
const server = await this.model.findOne({where: {serverName}});
|
const server = await this.model.findOne({where: {serverName}});
|
||||||
if (server) {
|
if (server) {
|
||||||
let PD = server.dataValues.playerData;
|
let playerData = 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.
|
if (playerData.length > 1920) playerData = []; //Selfnote: 86400/45 = 1920, where 86400 is seconds in a day and 45 is the MPModule's refresh interval.
|
||||||
PD.push(playerCount);
|
playerData.push(playerCount);
|
||||||
await this.model.update({playerData: PD}, {where: {serverName}});
|
await this.model.update({playerData}, {where: {serverName}});
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
Reference in New Issue
Block a user