1
0
mirror of https://github.com/toast-ts/Daggerbot-TS.git synced 2024-11-17 04:10:59 -05:00

Compare commits

...

2 Commits

Author SHA1 Message Date
toast-ts
b040aad719 Cleanup old automod rule 2024-07-17 19:23:45 +10:00
toast-ts
c3f6deea3b Update dependencies 2024-07-17 19:14:33 +10:00
6 changed files with 79 additions and 112 deletions

View File

@ -24,7 +24,7 @@ This is a revision history of how far we come in development cycle;
|----------|----------|---------|----------|
| V1 | JavaScript | Discord.JS v13 | Message commands |
| V2-V3 | TypeScript | Discord.JS v14 | Slash/message commands |
| V4 (Private) | Rust/Lua | Serenity v0.12.1 | Slash commands |
| V4 (Private) | Rust/Lua | Serenity v0.12 | Slash/context commands |
## CLI arguments (`process.argv[..]`)
`yarn dev` - Starts the development bot with predefined args.

View File

@ -28,7 +28,7 @@
"packageManager": "yarn@4.3.1+sha512.af78262d7d125afbfeed740602ace8c5e4405cd7f4735c08feb327286b2fdb2390fbca01589bfd1f50b1240548b74806767f5a063c94b67e431aabd0d86f7774",
"dependencies": {
"@napi-rs/canvas": "0.1.53",
"@octokit/rest": "21.0.0",
"@octokit/rest": "21.0.1",
"@sequelize/core": "7.0.0-alpha.41",
"@sequelize/postgres": "7.0.0-alpha.41",
"@toast/tokenservice-client": "1.2.8",
@ -36,17 +36,17 @@
"dayjs": "1.11.11",
"discord.js": "patch:discord.js@npm%3A14.15.3#~/.yarn/patches/discord.js-npm-14.15.3-0c74284e59.patch",
"fast-xml-parser": "4.4.0",
"mathjs": "13.0.0",
"mathjs": "13.0.2",
"ms": "2.1.3",
"node-cron": "3.0.3",
"redis": "4.6.14",
"redis": "4.6.15",
"simple-git": "3.25.0",
"systeminformation": "5.22.11",
"undici": "6.19.2"
},
"devDependencies": {
"@types/ms": "0.7.34",
"@types/node": "20.14.8",
"@types/node": "20.14.11",
"@types/node-cron": "3.0.11",
"typescript": "5.4.5"
}

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;

138
yarn.lock
View File

@ -5,12 +5,12 @@ __metadata:
version: 8
cacheKey: 10
"@babel/runtime@npm:^7.24.6":
version: 7.24.7
resolution: "@babel/runtime@npm:7.24.7"
"@babel/runtime@npm:^7.24.7":
version: 7.24.8
resolution: "@babel/runtime@npm:7.24.8"
dependencies:
regenerator-runtime: "npm:^0.14.0"
checksum: 10/7b77f566165dee62db3db0296e71d08cafda3f34e1b0dcefcd68427272e17c1704f4e4369bff76651b07b6e49d3ea5a0ce344818af9116e9292e4381e0918c76
checksum: 10/e6f335e472a8a337379effc15815dd0eddf6a7d0c00b50deb4f9e9585819b45431d0ff3c2d3d0fa58c227a9b04dcc4a85e7245fb57493adb2863b5208c769cbd
languageName: node
linkType: hard
@ -286,66 +286,66 @@ __metadata:
linkType: hard
"@octokit/plugin-paginate-rest@npm:^11.0.0":
version: 11.3.1
resolution: "@octokit/plugin-paginate-rest@npm:11.3.1"
version: 11.3.3
resolution: "@octokit/plugin-paginate-rest@npm:11.3.3"
dependencies:
"@octokit/types": "npm:^13.5.0"
peerDependencies:
"@octokit/core": 5
checksum: 10/82f5bcc3a536a44bed0a205c8301176c0d210b7a1c6d035a79b31a102e2e02f46234a38629cc984a21be544194ac69151814e9a909416aa7389cdffd1297bcd9
"@octokit/core": ">=6"
checksum: 10/87eeb4dd68a8207e669989cdbf9de3717b74038d630c2b803cbc7a9c44c3ff74771ce1cf45fa056b7172aaaa80fd9a0e4bf5eca06aabc19f30e7e29898f1f69e
languageName: node
linkType: hard
"@octokit/plugin-request-log@npm:^5.1.0":
version: 5.3.0
resolution: "@octokit/plugin-request-log@npm:5.3.0"
"@octokit/plugin-request-log@npm:^5.3.1":
version: 5.3.1
resolution: "@octokit/plugin-request-log@npm:5.3.1"
peerDependencies:
"@octokit/core": ">=6"
checksum: 10/8c918b14f0687e8a3d9c7c81ef1092a49de07681940cc1aee0aeb7e3dd8ac64f69af5d65932eec32f6db4af3dca80541ad3bb13ac0fa44af3e2340ed91909272
checksum: 10/a27e163282c8d0ba8feee4d3cbbd1b62e1aa89a892877f7a9876fc17ddde3e1e1af922e6664221a0cabae99b8a7a2a5215b9ec2ee5222edb50e06298e99022b0
languageName: node
linkType: hard
"@octokit/plugin-rest-endpoint-methods@npm:^13.0.0":
version: 13.2.2
resolution: "@octokit/plugin-rest-endpoint-methods@npm:13.2.2"
version: 13.2.4
resolution: "@octokit/plugin-rest-endpoint-methods@npm:13.2.4"
dependencies:
"@octokit/types": "npm:^13.5.0"
peerDependencies:
"@octokit/core": ^5
checksum: 10/9eccc1a22aa0b65f3f9378f26a74c386683db420c33202998918df1eef492e93212e1849e1d85530f425602663cfc2bfbf385a30991b8a04470334c74ba2386b
"@octokit/core": ">=6"
checksum: 10/5d90adb9b5ab52a7ce260fcd2acc48a6723fc888e4f5711f958694c4bfb53fa146ad6791ce651060566d1bd513b3d9287c44a25b1da866d9611c3e1e739b5981
languageName: node
linkType: hard
"@octokit/request-error@npm:^6.0.1":
version: 6.1.1
resolution: "@octokit/request-error@npm:6.1.1"
version: 6.1.4
resolution: "@octokit/request-error@npm:6.1.4"
dependencies:
"@octokit/types": "npm:^13.0.0"
checksum: 10/cae7bc4078629a02edcf35977f496a4b943e730165f6d7828795073f99a1d884ac67343b02eff69e553a5057765e466d70ddd9d266787f505aa29018858ab06d
checksum: 10/e4e475ec50cef8e271f39e69667d0f8eaccb2367aa56b81638c629b5bbfa2b697b40207301e5c797a63051a82d8698e7c792b4050b84e383c54300a49a01304a
languageName: node
linkType: hard
"@octokit/request@npm:^9.0.0":
version: 9.1.1
resolution: "@octokit/request@npm:9.1.1"
version: 9.1.3
resolution: "@octokit/request@npm:9.1.3"
dependencies:
"@octokit/endpoint": "npm:^10.0.0"
"@octokit/request-error": "npm:^6.0.1"
"@octokit/types": "npm:^13.1.0"
universal-user-agent: "npm:^7.0.2"
checksum: 10/aef47d85751c387c6ef29e70b3b86c9033fc7940361092c80728f7e99cc0ba54ddd00bbecb4422e50df78744600cfb8a1a2bc6916c5b6440677aa8ebd6b9b291
checksum: 10/b445f263157a2c608d8cfa89162be5f5d39551607d0ec973c3fdf9d3fd3753e33861c4e34942f5dbf47576ac91a99238ed482f2d6c6af3f9070e0b190b3f07a2
languageName: node
linkType: hard
"@octokit/rest@npm:21.0.0":
version: 21.0.0
resolution: "@octokit/rest@npm:21.0.0"
"@octokit/rest@npm:21.0.1":
version: 21.0.1
resolution: "@octokit/rest@npm:21.0.1"
dependencies:
"@octokit/core": "npm:^6.1.2"
"@octokit/plugin-paginate-rest": "npm:^11.0.0"
"@octokit/plugin-request-log": "npm:^5.1.0"
"@octokit/plugin-request-log": "npm:^5.3.1"
"@octokit/plugin-rest-endpoint-methods": "npm:^13.0.0"
checksum: 10/7da1c97866af04038fe4e384ce0a90cc4750bb951085c10053ceb73a4818cfe460336d7794ab3c65648cf5e195dba8e90940e36aec1e7ed22b6606cda38c88e0
checksum: 10/098188840d24761ce9833f2d9d866d4a6c2fdb9022d4f3cb53f4de44a1b2c90d6db5cc96382d534e139e3aea981593f5f94f693205f7cdd3ac388e266b3702e9
languageName: node
linkType: hard
@ -367,14 +367,14 @@ __metadata:
languageName: node
linkType: hard
"@redis/client@npm:1.5.16":
version: 1.5.16
resolution: "@redis/client@npm:1.5.16"
"@redis/client@npm:1.5.17":
version: 1.5.17
resolution: "@redis/client@npm:1.5.17"
dependencies:
cluster-key-slot: "npm:1.1.2"
generic-pool: "npm:3.9.0"
yallist: "npm:4.0.0"
checksum: 10/54bd45dcdb980e9682fc9aaad36607a34b6c05ebc733fc9a132db33ce77b3ff63c229d8d8b43ce2d7db115f31ff2fefcbcc7dceeaa1fc88c03e7c8012e456adf
checksum: 10/f7c3b978829b7151363545c81844cf75ecdb7bddf667f60d3bc4598e4fb3e957ebae6f2ed6b4bfb54038be6342bbe1789fd40e8193f6d49ac8861af279fecec8
languageName: node
linkType: hard
@ -511,9 +511,9 @@ __metadata:
linkType: hard
"@types/lodash@npm:^4.17.0":
version: 4.17.5
resolution: "@types/lodash@npm:4.17.5"
checksum: 10/10e2e9cbeb16998026f4071f9f5f2a38b651eba15302f512e0b8ab904c07c197ca0282d2821f64e53c2b692d7046af0a1ce3ead190fb077cbe4036948fce1924
version: 4.17.7
resolution: "@types/lodash@npm:4.17.7"
checksum: 10/b8177f19cf962414a66989837481b13f546afc2e98e8d465bec59e6ac03a59c584eb7053ce511cde3a09c5f3096d22a5ae22cfb56b23f3b0da75b0743b6b1a44
languageName: node
linkType: hard
@ -531,12 +531,12 @@ __metadata:
languageName: node
linkType: hard
"@types/node@npm:*, @types/node@npm:20.14.8":
version: 20.14.8
resolution: "@types/node@npm:20.14.8"
"@types/node@npm:*, @types/node@npm:20.14.11":
version: 20.14.11
resolution: "@types/node@npm:20.14.11"
dependencies:
undici-types: "npm:~5.26.4"
checksum: 10/73822f66f269ce865df7e2f586787ac7444bd1169fd265cbed1e851b72787f1170517c5b616e0308ec2fbc0934ec6403b0f28d4152acbb0486071aec41167d51
checksum: 10/344e1ce1ed16c86ed1c4209ab4d1de67db83dd6b694a6fabe295c47144dde2c58dabddae9f39a0a2bdd246e95f8d141ccfe848e464884b48b8918df4f7788025
languageName: node
linkType: hard
@ -559,18 +559,18 @@ __metadata:
linkType: hard
"@types/ws@npm:^8.5.10":
version: 8.5.10
resolution: "@types/ws@npm:8.5.10"
version: 8.5.11
resolution: "@types/ws@npm:8.5.11"
dependencies:
"@types/node": "npm:*"
checksum: 10/9b414dc5e0b6c6f1ea4b1635b3568c58707357f68076df9e7cd33194747b7d1716d5189c0dbdd68c8d2521b148e88184cf881bac7429eb0e5c989b001539ed31
checksum: 10/950d13b762fc7c092a0fc1450c41229a1d41abb93cb72251068885bd46fa4bbcf461c00df2e77de3f7a547371998b650a720ed90417562af0772b14a8a009dec
languageName: node
linkType: hard
"@vladfrangu/async_event_emitter@npm:^2.2.4":
version: 2.3.0
resolution: "@vladfrangu/async_event_emitter@npm:2.3.0"
checksum: 10/655a6bd2727e840b890be062ace1c0203f7fdd8ea2961029763fe0388512555c23935ad82c4f80900cb248146837582c103d7f6c293c10920b3b779377276d58
version: 2.4.4
resolution: "@vladfrangu/async_event_emitter@npm:2.4.4"
checksum: 10/634c2d656fb3a3b47584865b5bf2b92f06f19a0018324340c29f2215a82fc96b4997dc2a78c6aeefcb29b6b2f8c03e8f06234b45965b706f7bde5b997b7d8be2
languageName: node
linkType: hard
@ -658,21 +658,21 @@ __metadata:
resolution: "daggerbot-ts@workspace:."
dependencies:
"@napi-rs/canvas": "npm:0.1.53"
"@octokit/rest": "npm:21.0.0"
"@octokit/rest": "npm:21.0.1"
"@sequelize/core": "npm:7.0.0-alpha.41"
"@sequelize/postgres": "npm:7.0.0-alpha.41"
"@toast/tokenservice-client": "npm:1.2.8"
"@types/ms": "npm:0.7.34"
"@types/node": "npm:20.14.8"
"@types/node": "npm:20.14.11"
"@types/node-cron": "npm:3.0.11"
ansi-colors: "npm:4.1.3"
dayjs: "npm:1.11.11"
discord.js: "patch:discord.js@npm%3A14.15.3#~/.yarn/patches/discord.js-npm-14.15.3-0c74284e59.patch"
fast-xml-parser: "npm:4.4.0"
mathjs: "npm:13.0.0"
mathjs: "npm:13.0.2"
ms: "npm:2.1.3"
node-cron: "npm:3.0.3"
redis: "npm:4.6.14"
redis: "npm:4.6.15"
simple-git: "npm:3.25.0"
systeminformation: "npm:5.22.11"
typescript: "npm:5.4.5"
@ -904,11 +904,11 @@ __metadata:
languageName: node
linkType: hard
"mathjs@npm:13.0.0":
version: 13.0.0
resolution: "mathjs@npm:13.0.0"
"mathjs@npm:13.0.2":
version: 13.0.2
resolution: "mathjs@npm:13.0.2"
dependencies:
"@babel/runtime": "npm:^7.24.6"
"@babel/runtime": "npm:^7.24.7"
complex.js: "npm:^2.1.1"
decimal.js: "npm:^10.4.3"
escape-latex: "npm:^1.2.0"
@ -916,10 +916,10 @@ __metadata:
javascript-natural-sort: "npm:^0.7.1"
seedrandom: "npm:^3.0.5"
tiny-emitter: "npm:^2.1.0"
typed-function: "npm:^4.1.1"
typed-function: "npm:^4.2.1"
bin:
mathjs: bin/cli.js
checksum: 10/dff62ad0d9ad9c6f566e91b4cf304173d5d3ec1545f21ca1e4140691ca49a82b846abf8e540c34dabb1e7acd1d5474b654c5860a6b3f7c3175bc5bfc3dfbc759
checksum: 10/1481dfdd969d09ee3c4f7e16aea409fcdbfa2f14e4ce9d873e7e6d1470c121c271ecaf87a7a0da3f1e6ce883dcaef63a569332199f4b6a5c169a3e67d4396750
languageName: node
linkType: hard
@ -1163,17 +1163,17 @@ __metadata:
languageName: node
linkType: hard
"redis@npm:4.6.14":
version: 4.6.14
resolution: "redis@npm:4.6.14"
"redis@npm:4.6.15":
version: 4.6.15
resolution: "redis@npm:4.6.15"
dependencies:
"@redis/bloom": "npm:1.2.0"
"@redis/client": "npm:1.5.16"
"@redis/client": "npm:1.5.17"
"@redis/graph": "npm:1.1.1"
"@redis/json": "npm:1.0.6"
"@redis/search": "npm:1.1.6"
"@redis/time-series": "npm:1.0.5"
checksum: 10/5a00d678ea39a2e2fdaa961b593873e21677922b72671b00ab0feda3469506bc89c13221e56b1c00994504538ea45dd7ed6cde5d8be8da308a26f5d2424d0f85
checksum: 10/72f74fc80c89a8251e997b2c55bd05f5556191adeafe806ea17842ece5d2f80be31a76e161a9f0badcc5c35924044d642de66d3fc27215525f7332e9862e56d3
languageName: node
linkType: hard
@ -1215,11 +1215,11 @@ __metadata:
linkType: hard
"semver@npm:^7.3, semver@npm:^7.6.0":
version: 7.6.2
resolution: "semver@npm:7.6.2"
version: 7.6.3
resolution: "semver@npm:7.6.3"
bin:
semver: bin/semver.js
checksum: 10/296b17d027f57a87ef645e9c725bff4865a38dfc9caf29b26aa084b85820972fbe7372caea1ba6857162fa990702c6d9c1d82297cecb72d56c78ab29070d2ca2
checksum: 10/36b1fbe1a2b6f873559cd57b238f1094a053dbfd997ceeb8757d79d1d2089c56d1321b9f1069ce263dc64cfa922fa1d2ad566b39426fe1ac6c723c1487589e10
languageName: node
linkType: hard
@ -1319,13 +1319,13 @@ __metadata:
linkType: hard
"type-fest@npm:^4.14.0":
version: 4.20.1
resolution: "type-fest@npm:4.20.1"
checksum: 10/52dc64fae094949008afb79f21b02eca0289c8dc41ed1cfff88f343230edb476fca4815e1b5d58acf5e07fdc7a1b098504473b5931ef418e6f38a3edb70fc1df
version: 4.22.0
resolution: "type-fest@npm:4.22.0"
checksum: 10/f5e1471829166641cc52dd826839f40c43525a66c3fcd76bba8635bc2c42c339c7198b0f17395d23a91205da913be8294c58ab8d52cc03ef227386d24099f525
languageName: node
linkType: hard
"typed-function@npm:^4.1.1":
"typed-function@npm:^4.2.1":
version: 4.2.1
resolution: "typed-function@npm:4.2.1"
checksum: 10/2218d6e4a56c414c2d9c1e3cf2f0d26d6a8848d3e875cbd0eec5a791c25c4ee182cb488a6077b45b110334de7bd7f44fb049feac9e5216bef3172c22acbbf501
@ -1422,8 +1422,8 @@ __metadata:
linkType: hard
"ws@npm:^8.16.0":
version: 8.17.1
resolution: "ws@npm:8.17.1"
version: 8.18.0
resolution: "ws@npm:8.18.0"
peerDependencies:
bufferutil: ^4.0.1
utf-8-validate: ">=5.0.2"
@ -1432,7 +1432,7 @@ __metadata:
optional: true
utf-8-validate:
optional: true
checksum: 10/4264ae92c0b3e59c7e309001e93079b26937aab181835fb7af79f906b22cd33b6196d96556dafb4e985742dd401e99139572242e9847661fdbc96556b9e6902d
checksum: 10/70dfe53f23ff4368d46e4c0b1d4ca734db2c4149c6f68bc62cb16fc21f753c47b35fcc6e582f3bdfba0eaeb1c488cddab3c2255755a5c3eecb251431e42b3ff6
languageName: node
linkType: hard