mirror of
https://github.com/toast-ts/Daggerbot-TS.git
synced 2024-11-17 00:10:58 -05:00
Push uncommited changes from host
This commit is contained in:
parent
19903dbcc9
commit
784f6b1b62
@ -5,20 +5,18 @@ import MessageTool from '../helpers/MessageTool.js';
|
|||||||
export default class ProhibitedWords {
|
export default class ProhibitedWords {
|
||||||
static async run(client: TClient, interaction: Discord.ChatInputCommandInteraction<'cached'>){
|
static async run(client: TClient, interaction: Discord.ChatInputCommandInteraction<'cached'>){
|
||||||
if (!MessageTool.isModerator(interaction.member) && !client.config.whitelist.includes(interaction.member.id)) return MessageTool.youNeedRole(interaction, 'admin');
|
if (!MessageTool.isModerator(interaction.member) && !client.config.whitelist.includes(interaction.member.id)) return MessageTool.youNeedRole(interaction, 'admin');
|
||||||
const word = interaction.options.getString('word');
|
|
||||||
const wordExists = await client.prohibitedWords.findWord(word);
|
|
||||||
({
|
({
|
||||||
view: async()=>{
|
view: async()=>{
|
||||||
const pwList = await client.prohibitedWords.getAllWords();
|
const pwList = await client.prohibitedWords.getAllWords();
|
||||||
interaction.reply({
|
interaction.reply({
|
||||||
ephemeral: true,
|
ephemeral: true,
|
||||||
content: `There are currently **${pwList.length}** words in the list`,
|
content: `There are currently **${pwList.length}** words in the list`,
|
||||||
files: [
|
files: [new client.attachment(Buffer.from(JSON.stringify(pwList.map(x=>x.dataValues.word), null, 2)), {name: 'pwDump.json'})]
|
||||||
new client.attachment(Buffer.from(JSON.stringify(pwList.map(x=>x.dataValues.word), null, 2)), {name: 'pwDump.json'})
|
|
||||||
]
|
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
add: async()=>{
|
add: async()=>{
|
||||||
|
const word = interaction.options.getString('word');
|
||||||
|
const wordExists = await client.prohibitedWords.findWord(word);
|
||||||
if (wordExists) return interaction.reply({ephemeral: true, content: `\`${word}\` already exists in the list`});
|
if (wordExists) return interaction.reply({ephemeral: true, content: `\`${word}\` already exists in the list`});
|
||||||
else {
|
else {
|
||||||
await client.prohibitedWords.insertWord(word);
|
await client.prohibitedWords.insertWord(word);
|
||||||
@ -34,6 +32,8 @@ export default class ProhibitedWords {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
remove: async()=>{
|
remove: async()=>{
|
||||||
|
const word = interaction.options.getString('word');
|
||||||
|
const wordExists = await client.prohibitedWords.findWord(word);
|
||||||
if (!wordExists) return interaction.reply({ephemeral: true, content: `\`${word}\` does not exist in the list`});
|
if (!wordExists) return interaction.reply({ephemeral: true, content: `\`${word}\` does not exist in the list`});
|
||||||
else {
|
else {
|
||||||
await client.prohibitedWords.removeWord(word);
|
await client.prohibitedWords.removeWord(word);
|
||||||
|
@ -36,7 +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 {
|
static isSpam(client:TClient, message:Discord.Message, threshold:number): boolean {
|
||||||
const now = Date.now();
|
const now = Date.now();
|
||||||
const time = 30000;
|
const time = 30000;
|
||||||
@ -55,7 +55,7 @@ export default class Automoderator {
|
|||||||
data.timeout = setTimeout(()=>delete client.repeatedMessages[message.author.id], time);
|
data.timeout = setTimeout(()=>delete client.repeatedMessages[message.author.id], time);
|
||||||
}
|
}
|
||||||
return false;
|
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,7 +43,7 @@ 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',
|
name: 'messageSpam',
|
||||||
check: ()=>Automoderator.isSpam(client, message, 6) && !MessageTool.isStaff(message.member as Discord.GuildMember),
|
check: ()=>Automoderator.isSpam(client, message, 6) && !MessageTool.isStaff(message.member as Discord.GuildMember),
|
||||||
action: async()=>{
|
action: async()=>{
|
||||||
@ -53,12 +53,12 @@ export default class MessageCreate {
|
|||||||
await Automoderator.repeatedMessages(client, message, 'mute', 5000, 2, 'spam', '30m', 'Message spam');
|
await Automoderator.repeatedMessages(client, message, 'mute', 5000, 2, 'spam', '30m', 'Message spam');
|
||||||
delete client.repeatedMessages[message.author.id];
|
delete client.repeatedMessages[message.author.id];
|
||||||
}
|
}
|
||||||
},
|
},*/
|
||||||
{
|
{
|
||||||
name: 'discordInvite',
|
name: 'discordInvite',
|
||||||
check: ()=>message.content.toLowerCase().includes('discord.gg/') && !MessageTool.isStaff(message.member as Discord.GuildMember),
|
check: ()=>message.content.toLowerCase().match(/discord\.(gg|com\/invite)\//ig) && !MessageTool.isStaff(message.member as Discord.GuildMember),
|
||||||
action: async()=>{
|
action: async()=>{
|
||||||
const validInvite = await client.fetchInvite(message.content.split(' ').find(x=>x.includes('discord.gg/'))).catch(()=>null);
|
const validInvite = await client.fetchInvite(message.content.split(' ').find(x=>x.match(/discord\.(gg|com\/invite)\//ig))).catch(()=>null);
|
||||||
if (validInvite && validInvite.guild?.id !== client.config.dcServer.id) {
|
if (validInvite && validInvite.guild?.id !== client.config.dcServer.id) {
|
||||||
automodded = true;
|
automodded = true;
|
||||||
message.delete().catch(()=>Logger.console('log', `${automodLog}Advertisement`, automodFailReason));
|
message.delete().catch(()=>Logger.console('log', `${automodLog}Advertisement`, automodFailReason));
|
||||||
|
@ -4,7 +4,7 @@ const client = new TClient;
|
|||||||
client.init();
|
client.init();
|
||||||
import cron from 'node-cron';
|
import cron from 'node-cron';
|
||||||
import Logger from './helpers/Logger.js';
|
import Logger from './helpers/Logger.js';
|
||||||
import YTModule from './modules/YTModule.js';
|
//import YTModule from './modules/YTModule.js';
|
||||||
import CacheServer from './components/CacheServer.js';
|
import CacheServer from './components/CacheServer.js';
|
||||||
import MPModule, {refreshTimerSecs} from './modules/MPModule.js';
|
import MPModule, {refreshTimerSecs} from './modules/MPModule.js';
|
||||||
import UsernameHelper from './helpers/UsernameHelper.js';
|
import UsernameHelper from './helpers/UsernameHelper.js';
|
||||||
@ -26,7 +26,7 @@ if ((typeof process.argv[4] === 'string' && process.argv[4] === 'true') ?? null)
|
|||||||
|
|
||||||
// Interval timers for modules
|
// Interval timers for modules
|
||||||
setInterval(async()=>await MPModule(client), refreshTimerSecs);
|
setInterval(async()=>await MPModule(client), refreshTimerSecs);
|
||||||
cron.schedule('0-5 * * * *', ()=>YTModule(client)); // Every minute from 0 through 5
|
//cron.schedule('0-5 * * * *', ()=>YTModule(client)); // Every minute from 0 through 5
|
||||||
cron.schedule('5-12 * * * *', async()=>{// Every minute from 5 through 12
|
cron.schedule('5-12 * * * *', async()=>{// Every minute from 5 through 12
|
||||||
const forum = client.guilds.cache.get(client.config.dcServer.id).channels.cache.get(client.config.dcServer.channels.help_forum) as Discord.ForumChannel;
|
const forum = client.guilds.cache.get(client.config.dcServer.id).channels.cache.get(client.config.dcServer.channels.help_forum) as Discord.ForumChannel;
|
||||||
await forum.threads.fetch();
|
await forum.threads.fetch();
|
||||||
|
Loading…
Reference in New Issue
Block a user