mirror of
https://github.com/toast-ts/Daggerbot-TS.git
synced 2024-11-17 16:30:58 -05:00
Compare commits
4 Commits
b366680895
...
3e1a441ee4
Author | SHA1 | Date | |
---|---|---|---|
|
3e1a441ee4 | ||
|
5106f0e849 | ||
|
5e980363a3 | ||
|
07a4c48f97 |
40
.pnp.cjs
generated
40
.pnp.cjs
generated
@ -28,9 +28,9 @@ const RAW_RUNTIME_STATE =
|
||||
"packageDependencies": [\
|
||||
["@octokit/auth-token", "npm:4.0.0"],\
|
||||
["@octokit/rest", "npm:20.0.2"],\
|
||||
["@toast/tokenservice-client", "npm:1.0.10::__archiveUrl=https%3A%2F%2Fgit.toast-server.net%2Fapi%2Fpackages%2Ftoast%2Fnpm%2F%2540toast%252Ftokenservice-client%2F-%2F1.0.10%2Ftokenservice-client-1.0.10.tgz"],\
|
||||
["@toast/tokenservice-client", "npm:1.0.11::__archiveUrl=https%3A%2F%2Fgit.toast-server.net%2Fapi%2Fpackages%2Ftoast%2Fnpm%2F%2540toast%252Ftokenservice-client%2F-%2F1.0.11%2Ftokenservice-client-1.0.11.tgz"],\
|
||||
["@types/ms", "npm:0.7.34"],\
|
||||
["@types/node", "npm:20.11.6"],\
|
||||
["@types/node", "npm:20.11.10"],\
|
||||
["@types/node-cron", "npm:3.0.11"],\
|
||||
["@types/pg", "npm:8.11.0"],\
|
||||
["@types/sequelize", "npm:4.28.20"],\
|
||||
@ -48,7 +48,7 @@ const RAW_RUNTIME_STATE =
|
||||
["simple-git", "npm:3.22.0"],\
|
||||
["systeminformation", "npm:5.21.24"],\
|
||||
["typescript", "patch:typescript@npm%3A5.3.3#optional!builtin<compat/typescript>::version=5.3.3&hash=e012d7"],\
|
||||
["undici", "npm:6.4.0"]\
|
||||
["undici", "npm:6.5.0"]\
|
||||
],\
|
||||
"linkType": "SOFT"\
|
||||
}]\
|
||||
@ -571,11 +571,11 @@ const RAW_RUNTIME_STATE =
|
||||
}]\
|
||||
]],\
|
||||
["@toast/tokenservice-client", [\
|
||||
["npm:1.0.10::__archiveUrl=https%3A%2F%2Fgit.toast-server.net%2Fapi%2Fpackages%2Ftoast%2Fnpm%2F%2540toast%252Ftokenservice-client%2F-%2F1.0.10%2Ftokenservice-client-1.0.10.tgz", {\
|
||||
"packageLocation": "./.yarn/cache/@toast-tokenservice-client-npm-1.0.10-3f262fca44-f832828a1d.zip/node_modules/@toast/tokenservice-client/",\
|
||||
["npm:1.0.11::__archiveUrl=https%3A%2F%2Fgit.toast-server.net%2Fapi%2Fpackages%2Ftoast%2Fnpm%2F%2540toast%252Ftokenservice-client%2F-%2F1.0.11%2Ftokenservice-client-1.0.11.tgz", {\
|
||||
"packageLocation": "./.yarn/cache/@toast-tokenservice-client-npm-1.0.11-c95d3498fc-c910af2b01.zip/node_modules/@toast/tokenservice-client/",\
|
||||
"packageDependencies": [\
|
||||
["@toast/tokenservice-client", "npm:1.0.10::__archiveUrl=https%3A%2F%2Fgit.toast-server.net%2Fapi%2Fpackages%2Ftoast%2Fnpm%2F%2540toast%252Ftokenservice-client%2F-%2F1.0.10%2Ftokenservice-client-1.0.10.tgz"],\
|
||||
["undici", "npm:6.4.0"]\
|
||||
["@toast/tokenservice-client", "npm:1.0.11::__archiveUrl=https%3A%2F%2Fgit.toast-server.net%2Fapi%2Fpackages%2Ftoast%2Fnpm%2F%2540toast%252Ftokenservice-client%2F-%2F1.0.11%2Ftokenservice-client-1.0.11.tgz"],\
|
||||
["undici", "npm:6.5.0"]\
|
||||
],\
|
||||
"linkType": "HARD"\
|
||||
}]\
|
||||
@ -603,7 +603,7 @@ const RAW_RUNTIME_STATE =
|
||||
"packageLocation": "./.yarn/cache/@types-continuation-local-storage-npm-3.2.7-763e4dc12b-1f272b53bc.zip/node_modules/@types/continuation-local-storage/",\
|
||||
"packageDependencies": [\
|
||||
["@types/continuation-local-storage", "npm:3.2.7"],\
|
||||
["@types/node", "npm:20.11.6"]\
|
||||
["@types/node", "npm:20.11.10"]\
|
||||
],\
|
||||
"linkType": "HARD"\
|
||||
}]\
|
||||
@ -637,10 +637,10 @@ const RAW_RUNTIME_STATE =
|
||||
}]\
|
||||
]],\
|
||||
["@types/node", [\
|
||||
["npm:20.11.6", {\
|
||||
"packageLocation": "./.yarn/cache/@types-node-npm-20.11.6-e5e1974d32-375dfc75f0.zip/node_modules/@types/node/",\
|
||||
["npm:20.11.10", {\
|
||||
"packageLocation": "./.yarn/cache/@types-node-npm-20.11.10-169269fe65-41ca9c7e7c.zip/node_modules/@types/node/",\
|
||||
"packageDependencies": [\
|
||||
["@types/node", "npm:20.11.6"],\
|
||||
["@types/node", "npm:20.11.10"],\
|
||||
["undici-types", "npm:5.26.5"]\
|
||||
],\
|
||||
"linkType": "HARD"\
|
||||
@ -660,7 +660,7 @@ const RAW_RUNTIME_STATE =
|
||||
"packageLocation": "./.yarn/cache/@types-pg-npm-8.11.0-bf104da0ba-91a7ccc5dc.zip/node_modules/@types/pg/",\
|
||||
"packageDependencies": [\
|
||||
["@types/pg", "npm:8.11.0"],\
|
||||
["@types/node", "npm:20.11.6"],\
|
||||
["@types/node", "npm:20.11.10"],\
|
||||
["pg-protocol", "npm:1.6.0"],\
|
||||
["pg-types", "npm:4.0.1"]\
|
||||
],\
|
||||
@ -694,7 +694,7 @@ const RAW_RUNTIME_STATE =
|
||||
"packageLocation": "./.yarn/cache/@types-ws-npm-8.5.9-91d1b2ab07-7cf66383b8.zip/node_modules/@types/ws/",\
|
||||
"packageDependencies": [\
|
||||
["@types/ws", "npm:8.5.9"],\
|
||||
["@types/node", "npm:20.11.6"]\
|
||||
["@types/node", "npm:20.11.10"]\
|
||||
],\
|
||||
"linkType": "HARD"\
|
||||
}]\
|
||||
@ -993,9 +993,9 @@ const RAW_RUNTIME_STATE =
|
||||
["daggerbot-ts", "workspace:."],\
|
||||
["@octokit/auth-token", "npm:4.0.0"],\
|
||||
["@octokit/rest", "npm:20.0.2"],\
|
||||
["@toast/tokenservice-client", "npm:1.0.10::__archiveUrl=https%3A%2F%2Fgit.toast-server.net%2Fapi%2Fpackages%2Ftoast%2Fnpm%2F%2540toast%252Ftokenservice-client%2F-%2F1.0.10%2Ftokenservice-client-1.0.10.tgz"],\
|
||||
["@toast/tokenservice-client", "npm:1.0.11::__archiveUrl=https%3A%2F%2Fgit.toast-server.net%2Fapi%2Fpackages%2Ftoast%2Fnpm%2F%2540toast%252Ftokenservice-client%2F-%2F1.0.11%2Ftokenservice-client-1.0.11.tgz"],\
|
||||
["@types/ms", "npm:0.7.34"],\
|
||||
["@types/node", "npm:20.11.6"],\
|
||||
["@types/node", "npm:20.11.10"],\
|
||||
["@types/node-cron", "npm:3.0.11"],\
|
||||
["@types/pg", "npm:8.11.0"],\
|
||||
["@types/sequelize", "npm:4.28.20"],\
|
||||
@ -1013,7 +1013,7 @@ const RAW_RUNTIME_STATE =
|
||||
["simple-git", "npm:3.22.0"],\
|
||||
["systeminformation", "npm:5.21.24"],\
|
||||
["typescript", "patch:typescript@npm%3A5.3.3#optional!builtin<compat/typescript>::version=5.3.3&hash=e012d7"],\
|
||||
["undici", "npm:6.4.0"]\
|
||||
["undici", "npm:6.5.0"]\
|
||||
],\
|
||||
"linkType": "SOFT"\
|
||||
}]\
|
||||
@ -2606,10 +2606,10 @@ const RAW_RUNTIME_STATE =
|
||||
],\
|
||||
"linkType": "HARD"\
|
||||
}],\
|
||||
["npm:6.4.0", {\
|
||||
"packageLocation": "./.yarn/cache/undici-npm-6.4.0-3c1375c132-65552916aa.zip/node_modules/undici/",\
|
||||
["npm:6.5.0", {\
|
||||
"packageLocation": "./.yarn/cache/undici-npm-6.5.0-5598def435-0ad9289bd8.zip/node_modules/undici/",\
|
||||
"packageDependencies": [\
|
||||
["undici", "npm:6.4.0"],\
|
||||
["undici", "npm:6.5.0"],\
|
||||
["@fastify/busboy", "npm:2.0.0"]\
|
||||
],\
|
||||
"linkType": "HARD"\
|
||||
@ -2725,7 +2725,7 @@ const RAW_RUNTIME_STATE =
|
||||
"packageLocation": "./.yarn/cache/wkx-npm-0.5.0-fca5152cd8-b8975e33f9.zip/node_modules/wkx/",\
|
||||
"packageDependencies": [\
|
||||
["wkx", "npm:0.5.0"],\
|
||||
["@types/node", "npm:20.11.6"]\
|
||||
["@types/node", "npm:20.11.10"]\
|
||||
],\
|
||||
"linkType": "HARD"\
|
||||
}]\
|
||||
|
9
docker-compose.bot.yml
Normal file
9
docker-compose.bot.yml
Normal file
@ -0,0 +1,9 @@
|
||||
services:
|
||||
bot:
|
||||
container_name: daggerbot-prod
|
||||
build: .
|
||||
restart: unless-stopped
|
||||
volumes:
|
||||
- ./.git:/Daggerbot/.git:rw
|
||||
- ./src/:/Daggerbot/src/:rw
|
||||
- ./dist/:/Daggerbot/dist/:rw
|
@ -1,12 +1,4 @@
|
||||
services:
|
||||
bot:
|
||||
container_name: daggerbot-prod
|
||||
build: .
|
||||
restart: unless-stopped
|
||||
volumes:
|
||||
- ./.git:/Daggerbot/.git:rw
|
||||
- ./src/:/Daggerbot/src/:rw
|
||||
- ./dist/:/Daggerbot/dist/:rw
|
||||
cache:
|
||||
container_name: redis-cache
|
||||
image: redis/redis-stack-server:7.2.0-v6
|
||||
|
@ -34,7 +34,7 @@
|
||||
"dependencies": {
|
||||
"@octokit/auth-token": "4.0.0",
|
||||
"@octokit/rest": "20.0.2",
|
||||
"@toast/tokenservice-client": "1.0.10",
|
||||
"@toast/tokenservice-client": "1.0.11",
|
||||
"ansi-colors": "4.1.3",
|
||||
"canvas": "2.11.2",
|
||||
"dayjs": "1.11.10",
|
||||
@ -48,11 +48,11 @@
|
||||
"sequelize": "6.35.2",
|
||||
"simple-git": "3.22.0",
|
||||
"systeminformation": "5.21.24",
|
||||
"undici": "6.4.0"
|
||||
"undici": "6.5.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/ms": "0.7.34",
|
||||
"@types/node": "20.11.6",
|
||||
"@types/node": "20.11.10",
|
||||
"@types/node-cron": "3.0.11",
|
||||
"@types/pg": "8.11.0",
|
||||
"@types/sequelize": "4.28.20",
|
||||
|
@ -4,7 +4,7 @@ import Logger from '../helpers/Logger.js';
|
||||
export default class Automoderator {
|
||||
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 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();
|
||||
|
||||
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)) {
|
||||
this.lockQuery.add(message.author.id);
|
||||
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(()=>{
|
||||
this.lockQuery.delete(message.author.id);
|
||||
Logger.console('log', 'AUTOMOD', `Lock released for ${message.author.tag}`);
|
||||
|
@ -21,7 +21,7 @@ export default class MessageCreate {
|
||||
automodded = true;
|
||||
message.delete().catch(()=>Logger.console('log', 'AUTOMOD:PROHIBITEDWORDS', automodFailReason));
|
||||
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: {
|
||||
@ -32,7 +32,7 @@ export default class MessageCreate {
|
||||
automodded = true;
|
||||
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));
|
||||
await Automoderator.repeatedMessages(client, message, 60000, 2, 'adv', '1h', 'Discord advertisement');
|
||||
await Automoderator.repeatedMessages(client, message, 'ban', 60000, 4, 'adv', null, 'Discord advertisement');
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -1,3 +1,3 @@
|
||||
import TokenService from '@toast/tokenservice-client';
|
||||
|
||||
export default async()=>new TokenService(process.argv[3] ?? 'daggerbot').connect();
|
||||
export default async()=>new TokenService(process.argv[3] ?? 'daggerbot', false).connect();
|
||||
|
6
startDocker.sh
Normal file
6
startDocker.sh
Normal file
@ -0,0 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
docker compose -f docker-compose.bot.yml build bot && \
|
||||
docker compose -f docker-compose.bot.yml up -d bot
|
||||
|
||||
exit 0
|
32
yarn.lock
32
yarn.lock
@ -379,12 +379,12 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@toast/tokenservice-client@npm:1.0.10":
|
||||
version: 1.0.10
|
||||
resolution: "@toast/tokenservice-client@npm:1.0.10::__archiveUrl=https%3A%2F%2Fgit.toast-server.net%2Fapi%2Fpackages%2Ftoast%2Fnpm%2F%2540toast%252Ftokenservice-client%2F-%2F1.0.10%2Ftokenservice-client-1.0.10.tgz"
|
||||
"@toast/tokenservice-client@npm:1.0.11":
|
||||
version: 1.0.11
|
||||
resolution: "@toast/tokenservice-client@npm:1.0.11::__archiveUrl=https%3A%2F%2Fgit.toast-server.net%2Fapi%2Fpackages%2Ftoast%2Fnpm%2F%2540toast%252Ftokenservice-client%2F-%2F1.0.11%2Ftokenservice-client-1.0.11.tgz"
|
||||
dependencies:
|
||||
undici: "npm:6.4.0"
|
||||
checksum: f832828a1d076cd961fca408cf10b9240c99526801b6d68e262d3fab9b460ee1eb45bef0d37abc6eecd2e24f96d9af8c410a39f6f93337e352a1bf07110e3fca
|
||||
undici: "npm:6.5.0"
|
||||
checksum: c910af2b01876ca53de3078cf6b20c3cd8619ed807c3ce573074bc886a8690e6edc43f961088acf4bc2a7e925e8a0cb0e35df930b5923b20ecbbad6fd9bf4c81
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
@ -441,12 +441,12 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@types/node@npm:*, @types/node@npm:20.11.6":
|
||||
version: 20.11.6
|
||||
resolution: "@types/node@npm:20.11.6"
|
||||
"@types/node@npm:*, @types/node@npm:20.11.10":
|
||||
version: 20.11.10
|
||||
resolution: "@types/node@npm:20.11.10"
|
||||
dependencies:
|
||||
undici-types: "npm:~5.26.4"
|
||||
checksum: 375dfc75f0aa8b7fb99382d84c317e5dab2969dcc3f54d8490b119151060923eae6483839552347bc78262bbcefb2951ee131e15372f4e80b755be2dda9afe80
|
||||
checksum: 41ca9c7e7c95bf070ad747ab266f267f41950e01f5ddda739d0665c2ed39acc45cce46f78e33ffa2bf2dacd74a8493044b967c86358017dacce12958e49db664
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
@ -746,9 +746,9 @@ __metadata:
|
||||
dependencies:
|
||||
"@octokit/auth-token": "npm:4.0.0"
|
||||
"@octokit/rest": "npm:20.0.2"
|
||||
"@toast/tokenservice-client": "npm:1.0.10"
|
||||
"@toast/tokenservice-client": "npm:1.0.11"
|
||||
"@types/ms": "npm:0.7.34"
|
||||
"@types/node": "npm:20.11.6"
|
||||
"@types/node": "npm:20.11.10"
|
||||
"@types/node-cron": "npm:3.0.11"
|
||||
"@types/pg": "npm:8.11.0"
|
||||
"@types/sequelize": "npm:4.28.20"
|
||||
@ -766,7 +766,7 @@ __metadata:
|
||||
simple-git: "npm:3.22.0"
|
||||
systeminformation: "npm:5.21.24"
|
||||
typescript: "npm:5.3.3"
|
||||
undici: "npm:6.4.0"
|
||||
undici: "npm:6.5.0"
|
||||
languageName: unknown
|
||||
linkType: soft
|
||||
|
||||
@ -2160,12 +2160,12 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"undici@npm:6.4.0":
|
||||
version: 6.4.0
|
||||
resolution: "undici@npm:6.4.0"
|
||||
"undici@npm:6.5.0":
|
||||
version: 6.5.0
|
||||
resolution: "undici@npm:6.5.0"
|
||||
dependencies:
|
||||
"@fastify/busboy": "npm:^2.0.0"
|
||||
checksum: 65552916aa84eb8ea262cf7205bf2dc1ca86b616843adceb6d994a172a5a6be7fbf384ab790e7ede82811942f0c71a53e639309e92e05be044866ca54993e0be
|
||||
checksum: 0ad9289bd8dc8a5ee8cf81a48a629a59c33814702ae706b1d8e7c7fac3cfa85bd6a73943db5d9379f4d420858d239ed3857ec1003e517ddb67eb44fdbc227f3e
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user