1
0
mirror of https://github.com/toast-ts/Daggerbot-TS.git synced 2024-12-26 11:45:37 -05:00

little progress, yay automod now operational

This commit is contained in:
toast-ts 2022-11-19 03:54:40 +11:00
parent 3e94afb222
commit 8a90bb119b
8 changed files with 138 additions and 44 deletions

64
src/Daggerbot.config.json Normal file
View File

@ -0,0 +1,64 @@
{
"embedColor": "#0052cf",
"embedColorGreen": "#57f287",
"embedColorYellow": "#ffea00",
"embedColorRed": "#e62c3b",
"embedColorBCA": "#ff69b4",
"LRSstart": 1661236321433,
"botSwitches": {
"registerCommands": true,
"commands": false,
"logs": true,
"automod": true,
"mpstats": true,
"mpstatsDebug": false,
"autores": true
},
"eval": {
"allowed": true,
"whitelist": [
"190407856527376384",
"615761944154210305",
"593696856165449749",
"633345781780185099",
"506022868157595648",
"215497515934416896",
"309373272594579456"
]
},
"mainServer": {
"id": "468835415093411861",
"staffRoles": [
"admin",
"dcmod",
"mpmanager",
"mpmod",
"vtcmanager",
"vtcstaff",
"ytmod"
],
"roles": {
"admin": "468842789053136897",
"bottech": "1011341005389307925",
"dcmod": "468841295150972929",
"mpmanager": "1028735939813585029",
"mpmod": "572151330710487041",
"vtcmanager": "1028735871370940490",
"vtcstaff": "801945627268481046",
"ytmod": "734888335851388958",
"mphelper": "1034453973412884500",
"mpplayer": "798285830669598762",
"vtcmember": "802282391652663338"
},
"channels": {
"console": "1011318687065710663",
"errors": "1009754872188506192",
"thismeanswar": "930588618085502987",
"bot_status": "1009753780188884992",
"logs": "548032776830582794",
"welcome": "621134751897616406",
"botcommands": "468888722210029588"
}
}
}

View File

@ -428,7 +428,7 @@ class userLevels extends Database {
} }
} else if (data.messages >= this.algorithm(data.level+1)){// If user's message count meets/exceeds message requirement for next level... } else if (data.messages >= this.algorithm(data.level+1)){// If user's message count meets/exceeds message requirement for next level...
this._content[userid].level++;// Level them up. this._content[userid].level++;// Level them up.
(this.client.channels.resolve(this.client.config.mainServer.channels.thismeanswar) as Discord.TextChannel).send({content: `<@${userid}> has reached level **${data.level}**. GG!`}) (this.client.channels.resolve(this.client.config.mainServer.channels.thismeanswar) as Discord.TextChannel).send({content: `<@${userid}> has reached level **${data.level}**. GG!`, allowedMentions: {parse: ['users']}})
} }
} else {// If user doesn't exist on file, create an object for it. } else {// If user doesn't exist on file, create an object for it.
this._content[userid] = {messages: 1, level: 0}; this._content[userid] = {messages: 1, level: 0};

View File

@ -12,7 +12,7 @@ export default {
//if (member && adminPerm) return interaction.reply('You cannot bonk an admin!') //if (member && adminPerm) return interaction.reply('You cannot bonk an admin!')
if (member) { if (member) {
const embed = new client.embed().setColor(client.config.embedColor) const embed = new client.embed().setColor(client.config.embedColor)
.setDescription(`> <@${member.id}> has been bonked!\n${reason?.length == null ? '' : `> Reason: ${reason}`}`) .setDescription(`> <@${member.id}> has been bonked!\n${reason?.length == null ? '' : `> Reason: **${reason}**`}`)
.setImage('https://media.tenor.com/7tRddlNUNNcAAAAd/hammer-on-head-minions.gif') .setImage('https://media.tenor.com/7tRddlNUNNcAAAAd/hammer-on-head-minions.gif')
.setFooter({text: `Bonk count for ${member.tag}: ${await client.bonkCount.getUser(member.id).toLocaleString('en-US')}`}) .setFooter({text: `Bonk count for ${member.tag}: ${await client.bonkCount.getUser(member.id).toLocaleString('en-US')}`})
interaction.reply({embeds: [embed]}) interaction.reply({embeds: [embed]})

View File

@ -3,7 +3,7 @@ import { TClient } from 'src/client';
import { Punishment } from "src/typings/interfaces"; import { Punishment } from "src/typings/interfaces";
export default { export default {
async run(client: TClient, interaction: Discord.ChatInputCommandInteraction<'cached'>){ async run(client: TClient, interaction: Discord.ChatInputCommandInteraction<'cached'>){
if (!interaction.member.roles.cache.has(client.config.mainServer.roles.dcmod)) return client.youNeedRole(interaction, 'dcmod') if (!client.isStaff(interaction.member)) return client.youNeedRole(interaction, 'dcmod');
const Subb = interaction.options.getSubcommand(); const Subb = interaction.options.getSubcommand();
const caseId = interaction.options.getInteger('id'); const caseId = interaction.options.getInteger('id');
if (Subb == 'update'){ if (Subb == 'update'){

View File

@ -27,11 +27,11 @@ async function MPdata(client:TClient, interaction:Discord.ChatInputCommandIntera
return FSserver return FSserver
} }
export default { export default { //468835769092669461
async run(client: TClient, interaction: Discord.ChatInputCommandInteraction<'cached'>){ async run(client: TClient, interaction: Discord.ChatInputCommandInteraction<'cached'>){
if (interaction.channelId == '468835769092669461' && !client.isStaff(interaction.member) && ['status', 'players'].includes(interaction.options.getSubcommand())) { if (interaction.channelId == '904192878140608563' && !client.isStaff(interaction.member) && ['status', 'players'].includes(interaction.options.getSubcommand())) {
interaction.reply(`Please use <#739084625862852715> for \`/mp status/players\` commands to prevent clutter in this channel.`).then((msg)=>{ interaction.reply(`Please use <#739084625862852715> for \`/mp status/players\` commands to prevent clutter in this channel.`).then((msg)=>{
setTimeout(()=>{interaction.deleteReply()}, 500) setTimeout(()=>{interaction.deleteReply()}, 5000)
}); });
return; return;
} }

File diff suppressed because one or more lines are too long

View File

@ -1,22 +1,22 @@
{ {
"190407856527376384": { "190407856527376384": {
"messages": 53026, "messages": 53027,
"level": 59 "level": 59
}, },
"593696856165449749": { "593696856165449749": {
"messages": 51467, "messages": 51469,
"level": 58 "level": 58
}, },
"141304507249197057": { "141304507249197057": {
"messages": 67632, "messages": 67635,
"level": 67 "level": 67
}, },
"533707949831487488": { "533707949831487488": {
"messages": 57042, "messages": 57043,
"level": 61 "level": 61
}, },
"532662366354276352": { "532662366354276352": {
"messages": 33785, "messages": 33790,
"level": 47 "level": 47
}, },
"824043915539513406": { "824043915539513406": {
@ -24,7 +24,7 @@
"level": 35 "level": 35
}, },
"178941218510602240": { "178941218510602240": {
"messages": 6396, "messages": 6399,
"level": 20 "level": 20
}, },
"215497515934416896": { "215497515934416896": {
@ -32,15 +32,15 @@
"level": 46 "level": 46
}, },
"301350210926280704": { "301350210926280704": {
"messages": 14343, "messages": 14346,
"level": 30 "level": 30
}, },
"695323013813633076": { "695323013813633076": {
"messages": 14092, "messages": 14095,
"level": 30 "level": 30
}, },
"389237487094071337": { "389237487094071337": {
"messages": 12256, "messages": 12257,
"level": 28 "level": 28
}, },
"716355511552966737": { "716355511552966737": {
@ -76,7 +76,7 @@
"level": 18 "level": 18
}, },
"468837263577579524": { "468837263577579524": {
"messages": 7696, "messages": 7698,
"level": 22 "level": 22
}, },
"734703851558535188": { "734703851558535188": {
@ -148,7 +148,7 @@
"level": 0 "level": 0
}, },
"169891949464125441": { "169891949464125441": {
"messages": 541, "messages": 542,
"level": 6 "level": 6
}, },
"718453763932946432": { "718453763932946432": {
@ -228,7 +228,7 @@
"level": 2 "level": 2
}, },
"645342896312156181": { "645342896312156181": {
"messages": 696, "messages": 699,
"level": 6 "level": 6
}, },
"488505753133645826": { "488505753133645826": {
@ -400,7 +400,7 @@
"level": 0 "level": 0
}, },
"903147621961588757": { "903147621961588757": {
"messages": 15, "messages": 16,
"level": 1 "level": 1
}, },
"386627658773168137": { "386627658773168137": {
@ -528,7 +528,7 @@
"level": 0 "level": 0
}, },
"818595993121062974": { "818595993121062974": {
"messages": 48, "messages": 49,
"level": 1 "level": 1
}, },
"273755695680192513": { "273755695680192513": {
@ -1340,7 +1340,7 @@
"level": 0 "level": 0
}, },
"98464148379148288": { "98464148379148288": {
"messages": 1507, "messages": 1510,
"level": 10 "level": 10
}, },
"1025723411680460840": { "1025723411680460840": {
@ -1656,7 +1656,7 @@
"level": 0 "level": 0
}, },
"937750032344571934": { "937750032344571934": {
"messages": 103, "messages": 105,
"level": 2 "level": 2
}, },
"873149038709571594": { "873149038709571594": {
@ -1840,7 +1840,7 @@
"level": 0 "level": 0
}, },
"682165767109738507": { "682165767109738507": {
"messages": 106, "messages": 107,
"level": 2 "level": 2
}, },
"127840266701766656": { "127840266701766656": {
@ -2488,7 +2488,7 @@
"level": 0 "level": 0
}, },
"284482432684785664": { "284482432684785664": {
"messages": 3, "messages": 4,
"level": 0 "level": 0
}, },
"727948378067173407": { "727948378067173407": {
@ -2696,11 +2696,11 @@
"level": 0 "level": 0
}, },
"562257805927776286": { "562257805927776286": {
"messages": 8, "messages": 12,
"level": 0 "level": 0
}, },
"995622955897864272": { "995622955897864272": {
"messages": 96, "messages": 98,
"level": 2 "level": 2
}, },
"153323923633733632": { "153323923633733632": {
@ -2772,11 +2772,23 @@
"level": 0 "level": 0
}, },
"248226483967885312": { "248226483967885312": {
"messages": 3, "messages": 4,
"level": 0 "level": 0
}, },
"985545842368864326": { "985545842368864326": {
"messages": 2, "messages": 2,
"level": 0 "level": 0
},
"760459018539106315": {
"messages": 1,
"level": 0
},
"169553969025253376": {
"messages": 2,
"level": 0
},
"288711706535002125": {
"messages": 1,
"level": 0
} }
} }

View File

@ -3,7 +3,6 @@ import { TClient } from '../client';
export default { export default {
name: 'messageCreate', name: 'messageCreate',
execute: async(client:TClient, message:Discord.Message)=>{ execute: async(client:TClient, message:Discord.Message)=>{
if (!client.config.botSwitches.commands && !client.config.eval.whitelist.includes(message.author.id)) return
if (message.author.bot) return; if (message.author.bot) return;
if (message.channel.type === ChannelType.DM) return; if (message.channel.type === ChannelType.DM) return;
const msgarr = message.content.toLowerCase().split(' '); const msgarr = message.content.toLowerCase().split(' ');
@ -17,10 +16,10 @@ export default {
// Arrary of channel ids for automod to be disabled in // Arrary of channel ids for automod to be disabled in
] ]
if (client.bannedWords._content.some((x: any)=>msgarr.includes(x)) && !message.member.roles.cache.has(client.config.mainServer.roles.dcmod) && message.guildId == client.config.mainServer.id && !Whitelist.includes(message.channelId) && client.config.botSwitches.automod){ if (client.bannedWords._content.some((x)=>msgarr.includes(x)) && !message.member.roles.cache.has(client.config.mainServer.roles.dcmod) && message.guildId == client.config.mainServer.id && !Whitelist.includes(message.channelId) && client.config.botSwitches.automod){
automodded = true; automodded = true;
message.delete(); message.delete();
message.channel.send('That word is banned here.').then((x: any)=>setTimeout(()=>x.delete(), 5000)); message.channel.send('That word is banned here.').then((x)=>setTimeout(()=>x.delete(), 5000));
if (client.repeatedMessages[message.author.id]){ if (client.repeatedMessages[message.author.id]){
// add this message to the list // add this message to the list
client.repeatedMessages[message.author.id].set(message.createdTimestamp, {cont: 0, ch: message.channelId}); client.repeatedMessages[message.author.id].set(message.createdTimestamp, {cont: 0, ch: message.channelId});
@ -33,10 +32,10 @@ export default {
const threshold = 30000; const threshold = 30000;
// message mustve been sent after (now - threshold), so purge those that were sent earlier // message mustve been sent after (now - threshold), so purge those that were sent earlier
client.repeatedMessages[message.author.id] = client.repeatedMessages[message.author.id].filter((x: any, i: any)=>i >= Date.now() - threshold) client.repeatedMessages[message.author.id] = client.repeatedMessages[message.author.id].filter((x, i)=>i >= Date.now() - threshold)
// a spammed message is one that has been sent atleast 4 times in the last threshold milliseconds // a spammed message is one that has been sent atleast 4 times in the last threshold milliseconds
const spammedMessage = client.repeatedMessages[message.author.id]?.find((x:any)=>{ const spammedMessage = client.repeatedMessages[message.author.id]?.find((x)=>{
return client.repeatedMessages[message.author.id].size >= 4; return client.repeatedMessages[message.author.id].size >= 4;
}); });
@ -66,14 +65,27 @@ export default {
const bannedChannels = [ const bannedChannels = [
'516344221452599306', // #mp-moderators '516344221452599306', // #mp-moderators
'742324777934520350', // #discord-moderators '742324777934520350', // #discord-moderators
'904192878140608563'
] ]
if (message.content.toLowerCase().includes('tenor.com/view') || message.content.toLowerCase().includes('giphy.com/gifs/') || message.content.toLowerCase().includes('giphy.com/media/') && bannedChannels.includes(message.channelId)) { const gifURL = [
'tenor.com/view',
'giphy.com/gifs',
'giphy.com/media'
]
if (gifURL.some(e=>message.content.toLowerCase().includes(e)) && bannedChannels.includes(message.channelId)) {
message.reply('Gifs are not allowed in this channel.').then((msg: any)=>message.delete()) message.reply('Gifs are not allowed in this channel.').then((msg: any)=>message.delete())
} }
// Autoresponse:tm: // Autoresponse:tm:
if (client.config.botSwitches.autores && !automodded) { if (client.config.botSwitches.autores && !automodded) {
const MorningArray = ['good morning', 'morning all', 'morning everyone', 'morning lads']
const AfternoonArray = ['good afternoon', 'afternoon all']
const EveningArray = ['good evening', 'evening all', 'evening everyone']
const NightArray = ['night all', 'night everyone']
const PasswordArray = ['whats the password', 'what\'s the password', 'password pls']
const cantRead = ['i cant read', 'i can\'t read', 'cant read', 'can\'t read']
const NawdicBrokeIt = ['break', 'broke', 'broken']
const deadChat = ['dead chat', 'chat is dead', 'dead server']
if (message.mentions.members.has('309373272594579456') && !client.isStaff(message.member) && message.type != 19){ if (message.mentions.members.has('309373272594579456') && !client.isStaff(message.member) && message.type != 19){
message.reply('Please don\'t tag Daggerwin, read rule 14 in <#468846117405196289>') message.reply('Please don\'t tag Daggerwin, read rule 14 in <#468846117405196289>')
} }
@ -81,34 +93,40 @@ export default {
message.reply('Please don\'t tag Monster unless it\'s important!') message.reply('Please don\'t tag Monster unless it\'s important!')
} }
if (message.content.toLowerCase().startsWith(`*mp players`) || message.content.toLowerCase().startsWith(`*mp status`)){ if (message.content.toLowerCase().startsWith(`*mp players`) || message.content.toLowerCase().startsWith(`*mp status`)){
message.reply('Prefix-based MP commands has been moved to `/mp players` and `/mp status`') message.reply('Prefix-based MP commands has moved to `/mp players` and `/mp status`')
} }
if (message.content.toLowerCase().includes('whats the password') || message.content.toLowerCase().includes('what\'s the password') || message.content.toLowerCase().includes('password pls')){ if (message.content.toLowerCase().startsWith(`*lrs`) || message.content.toLowerCase().startsWith(`*rank`)){
message.reply('Prefix-based LRS command has moved to `/rank view`')
}
if (message.content.toLowerCase().startsWith(`*mp series`) || message.content.toLowerCase().startsWith(`*mp info`)){
message.reply('Prefix-based info commands has moved to `/faq`')
}
if (PasswordArray.some(e=>message.content.toLowerCase().includes(e))){
message.reply('Password and other details can be found in <#543494084363288637>') message.reply('Password and other details can be found in <#543494084363288637>')
} }
if (message.content.toLowerCase().includes('i cant read') || message.content.toLowerCase().includes('i can\'t read')){ if (cantRead.some(e=>message.content.toLowerCase().includes(e))){
message.reply('https://tenor.com/view/aristocats-george-pen-cap-meticulous-gif-5330931') message.reply('https://tenor.com/view/aristocats-george-pen-cap-meticulous-gif-5330931')
} }
if (message.content.toLowerCase().includes('is daggerbot working')){ if (message.content.toLowerCase().includes('is daggerbot working')){
message.reply('https://tenor.com/view/i-still-feel-alive-living-existing-active-singing-gif-14630579') message.reply('https://tenor.com/view/i-still-feel-alive-living-existing-active-singing-gif-14630579')
} }
if (message.content.toLowerCase().includes('dead chat') || message.content.toLowerCase().includes('chat is dead')){ if (deadChat.some(e=>message.content.toLowerCase().includes(e))){
message.reply('https://cdn.discordapp.com/attachments/925589318276382720/1011333656167579849/F57G5ZS.png') message.reply('https://cdn.discordapp.com/attachments/925589318276382720/1011333656167579849/F57G5ZS.png')
} }
if (message.content.toLowerCase().includes('nawdic') && (message.content.toLowerCase().includes('break') || message.content.toLowerCase().includes('broke') || message.content.toLowerCase().includes('broken'))){ if (message.content.toLowerCase().includes('nawdic') && (NawdicBrokeIt.some(e=>message.content.toLowerCase().includes(e)))){
const embed = new client.embed().setTitle('*Nawdic has done an oopsie*').setImage('https://c.tenor.com/JSj9ie_MD9kAAAAC/kopfsch%C3%BCtteln-an-kopf-fassen-oh-no.gif').setColor(client.config.embedColor) const embed = new client.embed().setTitle('*Nawdic has done an oopsie*').setImage('https://c.tenor.com/JSj9ie_MD9kAAAAC/kopfsch%C3%BCtteln-an-kopf-fassen-oh-no.gif').setColor(client.config.embedColor)
message.reply({embeds: [embed]}) message.reply({embeds: [embed]})
} }
if (message.content.toLowerCase().startsWith('good morning') || message.content.toLowerCase().startsWith('morning all') || message.content.toLowerCase().startsWith('morning everyone')){ if (MorningArray.some(e=>message.content.toLowerCase().startsWith(e))){
message.reply(`Good morning **${message.member.displayName}**!`) message.reply(`Good morning **${message.member.displayName}**!`)
} }
if (message.content.toLowerCase().startsWith('good afternoon') || message.content.toLowerCase().startsWith('afternoon all')){ if (AfternoonArray.some(e=>message.content.toLowerCase().startsWith(e))){
message.reply(`Afternoon **${message.member.displayName}**!`) message.reply(`Afternoon **${message.member.displayName}**!`)
} }
if (message.content.toLowerCase().startsWith('good evening') || message.content.toLowerCase().startsWith('evening all')){ if (EveningArray.some(e=>message.content.toLowerCase().startsWith(e))){
message.reply(`Good evening **${message.member.displayName}**!`) message.reply(`Good evening **${message.member.displayName}**!`)
} }
if (message.content.toLowerCase().startsWith('night all') || message.content.toLowerCase().startsWith('night everyone')){ if (NightArray.some(e=>message.content.toLowerCase().startsWith(e))){
message.reply(`Night **${message.member.displayName}**`) message.reply(`Night **${message.member.displayName}**`)
} }
} }