1
0
mirror of https://github.com/toast-ts/Daggerbot-TS.git synced 2024-11-17 16:30:58 -05:00

Compare commits

..

No commits in common. "3a06ea39536f793546a8e0c812b6da73d3afb7a3" and "79da90cab8f9d87466d29fbfa433ad88d7ac71ed" have entirely different histories.

7 changed files with 145 additions and 125 deletions

22
.pnp.cjs generated
View File

@ -30,7 +30,7 @@ const RAW_RUNTIME_STATE =
["@octokit/rest", "npm:20.0.2"],\ ["@octokit/rest", "npm:20.0.2"],\
["@toast/tokenservice-client", "npm:1.0.6::__archiveUrl=https%3A%2F%2Fgit.toast-server.net%2Fapi%2Fpackages%2Ftoast%2Fnpm%2F%2540toast%252Ftokenservice-client%2F-%2F1.0.6%2Ftokenservice-client-1.0.6.tgz"],\ ["@toast/tokenservice-client", "npm:1.0.6::__archiveUrl=https%3A%2F%2Fgit.toast-server.net%2Fapi%2Fpackages%2Ftoast%2Fnpm%2F%2540toast%252Ftokenservice-client%2F-%2F1.0.6%2Ftokenservice-client-1.0.6.tgz"],\
["@types/ms", "npm:0.7.34"],\ ["@types/ms", "npm:0.7.34"],\
["@types/node", "npm:20.10.6"],\ ["@types/node", "npm:20.10.5"],\
["@types/node-cron", "npm:3.0.11"],\ ["@types/node-cron", "npm:3.0.11"],\
["@types/pg", "npm:8.10.9"],\ ["@types/pg", "npm:8.10.9"],\
["@types/sequelize", "npm:4.28.19"],\ ["@types/sequelize", "npm:4.28.19"],\
@ -45,7 +45,7 @@ const RAW_RUNTIME_STATE =
["pg-hstore", "npm:2.3.4"],\ ["pg-hstore", "npm:2.3.4"],\
["redis", "npm:4.6.12"],\ ["redis", "npm:4.6.12"],\
["sequelize", "virtual:20c353e2d6536e37339997f03975c6a660f4d296e664d291bd43620c6162cca8eb5ef90b0998dc9db75ff6862e5da587d0530bae26805f5fadc8f17aaa4ff794#npm:6.35.2"],\ ["sequelize", "virtual:20c353e2d6536e37339997f03975c6a660f4d296e664d291bd43620c6162cca8eb5ef90b0998dc9db75ff6862e5da587d0530bae26805f5fadc8f17aaa4ff794#npm:6.35.2"],\
["simple-git", "npm:3.22.0"],\ ["simple-git", "npm:3.21.0"],\
["systeminformation", "npm:5.21.22"],\ ["systeminformation", "npm:5.21.22"],\
["typescript", "patch:typescript@npm%3A5.3.3#optional!builtin<compat/typescript>::version=5.3.3&hash=e012d7"],\ ["typescript", "patch:typescript@npm%3A5.3.3#optional!builtin<compat/typescript>::version=5.3.3&hash=e012d7"],\
["undici", "npm:6.2.1"]\ ["undici", "npm:6.2.1"]\
@ -644,14 +644,6 @@ const RAW_RUNTIME_STATE =
["undici-types", "npm:5.26.5"]\ ["undici-types", "npm:5.26.5"]\
],\ ],\
"linkType": "HARD"\ "linkType": "HARD"\
}],\
["npm:20.10.6", {\
"packageLocation": "./.yarn/cache/@types-node-npm-20.10.6-59a7d708ba-08471220d3.zip/node_modules/@types/node/",\
"packageDependencies": [\
["@types/node", "npm:20.10.6"],\
["undici-types", "npm:5.26.5"]\
],\
"linkType": "HARD"\
}]\ }]\
]],\ ]],\
["@types/node-cron", [\ ["@types/node-cron", [\
@ -1003,7 +995,7 @@ const RAW_RUNTIME_STATE =
["@octokit/rest", "npm:20.0.2"],\ ["@octokit/rest", "npm:20.0.2"],\
["@toast/tokenservice-client", "npm:1.0.6::__archiveUrl=https%3A%2F%2Fgit.toast-server.net%2Fapi%2Fpackages%2Ftoast%2Fnpm%2F%2540toast%252Ftokenservice-client%2F-%2F1.0.6%2Ftokenservice-client-1.0.6.tgz"],\ ["@toast/tokenservice-client", "npm:1.0.6::__archiveUrl=https%3A%2F%2Fgit.toast-server.net%2Fapi%2Fpackages%2Ftoast%2Fnpm%2F%2540toast%252Ftokenservice-client%2F-%2F1.0.6%2Ftokenservice-client-1.0.6.tgz"],\
["@types/ms", "npm:0.7.34"],\ ["@types/ms", "npm:0.7.34"],\
["@types/node", "npm:20.10.6"],\ ["@types/node", "npm:20.10.5"],\
["@types/node-cron", "npm:3.0.11"],\ ["@types/node-cron", "npm:3.0.11"],\
["@types/pg", "npm:8.10.9"],\ ["@types/pg", "npm:8.10.9"],\
["@types/sequelize", "npm:4.28.19"],\ ["@types/sequelize", "npm:4.28.19"],\
@ -1018,7 +1010,7 @@ const RAW_RUNTIME_STATE =
["pg-hstore", "npm:2.3.4"],\ ["pg-hstore", "npm:2.3.4"],\
["redis", "npm:4.6.12"],\ ["redis", "npm:4.6.12"],\
["sequelize", "virtual:20c353e2d6536e37339997f03975c6a660f4d296e664d291bd43620c6162cca8eb5ef90b0998dc9db75ff6862e5da587d0530bae26805f5fadc8f17aaa4ff794#npm:6.35.2"],\ ["sequelize", "virtual:20c353e2d6536e37339997f03975c6a660f4d296e664d291bd43620c6162cca8eb5ef90b0998dc9db75ff6862e5da587d0530bae26805f5fadc8f17aaa4ff794#npm:6.35.2"],\
["simple-git", "npm:3.22.0"],\ ["simple-git", "npm:3.21.0"],\
["systeminformation", "npm:5.21.22"],\ ["systeminformation", "npm:5.21.22"],\
["typescript", "patch:typescript@npm%3A5.3.3#optional!builtin<compat/typescript>::version=5.3.3&hash=e012d7"],\ ["typescript", "patch:typescript@npm%3A5.3.3#optional!builtin<compat/typescript>::version=5.3.3&hash=e012d7"],\
["undici", "npm:6.2.1"]\ ["undici", "npm:6.2.1"]\
@ -2406,10 +2398,10 @@ const RAW_RUNTIME_STATE =
}]\ }]\
]],\ ]],\
["simple-git", [\ ["simple-git", [\
["npm:3.22.0", {\ ["npm:3.21.0", {\
"packageLocation": "./.yarn/cache/simple-git-npm-3.22.0-42ea3caec2-309e7f0b73.zip/node_modules/simple-git/",\ "packageLocation": "./.yarn/cache/simple-git-npm-3.21.0-692f82a4a3-6b644151a4.zip/node_modules/simple-git/",\
"packageDependencies": [\ "packageDependencies": [\
["simple-git", "npm:3.22.0"],\ ["simple-git", "npm:3.21.0"],\
["@kwsites/file-exists", "npm:1.1.1"],\ ["@kwsites/file-exists", "npm:1.1.1"],\
["@kwsites/promise-deferred", "npm:1.1.1"],\ ["@kwsites/promise-deferred", "npm:1.1.1"],\
["debug", "virtual:428f325a939c2653ad822eb3d75efb02ac311523dd0d4f9645afc39ea00bd86eceac35a9d59c9b6977d76b670a4ef0ae057ea572338a44729aa592711a8c05a3#npm:4.3.4"]\ ["debug", "virtual:428f325a939c2653ad822eb3d75efb02ac311523dd0d4f9645afc39ea00bd86eceac35a9d59c9b6977d76b670a4ef0ae057ea572338a44729aa592711a8c05a3#npm:4.3.4"]\

View File

@ -46,13 +46,13 @@
"pg-hstore": "2.3.4", "pg-hstore": "2.3.4",
"redis": "4.6.12", "redis": "4.6.12",
"sequelize": "6.35.2", "sequelize": "6.35.2",
"simple-git": "3.22.0", "simple-git": "3.21.0",
"systeminformation": "5.21.22", "systeminformation": "5.21.22",
"undici": "6.2.1" "undici": "6.2.1"
}, },
"devDependencies": { "devDependencies": {
"@types/ms": "0.7.34", "@types/ms": "0.7.34",
"@types/node": "20.10.6", "@types/node": "20.10.5",
"@types/node-cron": "3.0.11", "@types/node-cron": "3.0.11",
"@types/pg": "8.10.9", "@types/pg": "8.10.9",
"@types/sequelize": "4.28.19", "@types/sequelize": "4.28.19",

View File

@ -1,90 +1,85 @@
{ {
"configName": "Daggerbot", "configName": "Daggerbot",
"embedColor": "#0052cf", "embedColor": "#ffffff",
"embedColorBackup": "#0052cf", "embedColorBackup": "#0052cf",
"embedColorGreen": "#57f287", "embedColorGreen": "#57f287",
"embedColorYellow": "#ffea00", "embedColorYellow": "#ffea00",
"embedColorRed": "#e62c3b", "embedColorRed": "#e62c3b",
"embedColorInvis": "#2f3136", "embedColorInvis": "#2f3136",
"embedColorBCA": "#ff69b4", "embedColorBCA": "#ff69b4",
"embedColorXmas": "#ffffff", "embedColorXmas": "#ffffff",
"LRSstart": 1704067200631, "LRSstart": 1661236321433,
"whitelistedServers": [ "whitelistedServers": [
"929807948748832798", "929807948748832798", "468835415093411861"
"468835415093411861" ],
], "botSwitches": {
"botSwitches": { "dailyMsgsBackup": true,
"dailyMsgsBackup": true, "registerCommands": false,
"registerCommands": false, "commands": true,
"commands": true, "logs": true,
"logs": true, "mpSys": true,
"mpSys": true, "buttonRoles": true,
"buttonRoles": true, "automod": true,
"automod": true, "autores": true
"autores": true },
}, "botPresence": {
"botPresence": { "activities": [
"activities": [ {"name": "Today is January!", "url": "https://www.youtube.com/watch?v=UPSSUSLlwjY", "type": 1}
{ ],
"name": "Today is January!", "status": "online"
"url": "https://www.youtube.com/watch?v=UPSSUSLlwjY", },
"type": 1 "whitelist": [
} "190407856527376384",
], "215497515934416896",
"status": "online" "141304507249197057",
}, "309373272594579456",
"whitelist": [ "301350210926280704"
"190407856527376384", ],
"215497515934416896", "contribList": [
"141304507249197057", "190407856527376384",
"309373272594579456", "633345781780185099",
"301350210926280704" "215497515934416896",
], "141304507249197057",
"contribList": [ "178941218510602240",
"190407856527376384", "700641965787709520"
"633345781780185099", ],
"215497515934416896", "dcServer": {
"141304507249197057", "id": "468835415093411861",
"178941218510602240", "staffRoles": [
"700641965787709520" "admin",
], "dcmod",
"dcServer": { "mpmanager",
"id": "468835415093411861", "mpmod",
"staffRoles": [ "vtcmanager",
"admin", "vtcstaff",
"dcmod", "ytmod"
"mpmanager", ],
"mpmod", "roles": {
"vtcmanager", "admin": "468842789053136897",
"vtcstaff", "bottech": "1011341005389307925",
"ytmod" "dcmod": "468841295150972929",
], "mpmanager": "1028735939813585029",
"roles": { "mpmod": "572151330710487041",
"admin": "468842789053136897", "vtcmanager": "1028735871370940490",
"bottech": "1011341005389307925", "vtcstaff": "801945627268481046",
"dcmod": "468841295150972929", "ytmod": "734888335851388958",
"mpmanager": "1028735939813585029", "mphelper": "1034453973412884500",
"mpmod": "572151330710487041", "mpplayer": "798285830669598762",
"vtcmanager": "1028735871370940490", "vtcmember": "802282391652663338"
"vtcstaff": "801945627268481046", },
"ytmod": "734888335851388958", "channels": {
"mphelper": "1034453973412884500", "errors": "1009754872188506192",
"mpplayer": "798285830669598762", "thismeanswar": "1091300529696673792",
"vtcmember": "802282391652663338" "bot_suggestions": "1040018521746325586",
}, "bot_status": "1009753780188884992",
"channels": { "logs": "548032776830582794",
"errors": "1009754872188506192", "welcome": "621134751897616406",
"thismeanswar": "1091300529696673792", "botcommands": "468888722210029588",
"bot_suggestions": "1040018521746325586", "bankick_log": "1048341961901363352",
"bot_status": "1009753780188884992", "punishment_log": "1102751034754998302",
"logs": "548032776830582794", "dcmod_chat": "742324777934520350",
"welcome": "621134751897616406", "mpmod_chat": "516344221452599306",
"botcommands": "468888722210029588", "multifarm_chat": "1149238561934151690"
"bankick_log": "1048341961901363352", }
"punishment_log": "1102751034754998302", }
"dcmod_chat": "742324777934520350", }
"mpmod_chat": "516344221452599306",
"multifarm_chat": "1149238561934151690"
}
}
}

View File

@ -7,6 +7,7 @@ import {Model, DataTypes} from 'sequelize';
import CacheServer from '../components/CacheServer.js'; import CacheServer from '../components/CacheServer.js';
import MessageTool from '../helpers/MessageTool.js'; import MessageTool from '../helpers/MessageTool.js';
import Formatters from '../helpers/Formatters.js'; import Formatters from '../helpers/Formatters.js';
import {readFileSync, existsSync} from 'node:fs';
class punishments extends Model { class punishments extends Model {
declare public case_id: number; declare public case_id: number;
@ -78,6 +79,23 @@ export class PunishmentsSvc {
}); });
this.model.sync(); this.model.sync();
} }
async migrate() {
let file:string = 'src/punishments.json';
if (!existsSync(file)) return Error(`File not found, have you tried checking if it exists? (${file})`);
await this.model.bulkCreate(JSON.parse(readFileSync(file, 'utf8')).map(x=>({
case_id: x._id,
type: x.type,
member: x.member,
moderator: x.moderator,
expired: x.expired,
time: x.time ? Number(x.time.$numberLong) : undefined,
reason: x.reason,
endTime: x.endTime ? Number(x.endTime.$numberLong) : undefined,
cancels: x.cancels,
duration: x.duration ? (typeof x.duration === 'object' ? Number(x.duration.$numberLong) : x.duration) : undefined
})));
}
async updateReason(caseId:number, reason:string) { async updateReason(caseId:number, reason:string) {
const findCase = this.findCase(caseId); const findCase = this.findCase(caseId);
if (findCase) return this.model.update({reason: reason}, {where: {case_id: caseId}}); if (findCase) return this.model.update({reason: reason}, {where: {case_id: caseId}});

View File

@ -3,6 +3,7 @@ import MessageTool from '../helpers/MessageTool.js';
import CacheServer from '../components/CacheServer.js'; import CacheServer from '../components/CacheServer.js';
import DatabaseServer from '../components/DatabaseServer.js'; import DatabaseServer from '../components/DatabaseServer.js';
import {Model, DataTypes} from 'sequelize'; import {Model, DataTypes} from 'sequelize';
import {readFileSync, existsSync} from 'node:fs';
import {ChatInputCommandInteraction, Snowflake} from 'discord.js'; import {ChatInputCommandInteraction, Snowflake} from 'discord.js';
class tagsystem extends Model { class tagsystem extends Model {
@ -50,6 +51,17 @@ export class TagSystemSvc {
}); });
this.model.sync(); this.model.sync();
} }
async migrate() {
let file:string = 'src/tags.json';
if (!existsSync(file)) return Error(`File not found, have you tried checking if it exists? (${file})`);
await this.model.bulkCreate(JSON.parse(readFileSync(file, 'utf8')).map(x=>({
tagname: x._id,
message: x.message,
embedFlag: x.embedBool,
userid: x.user._id
})));
}
async createTag(userid:string, tagName:string, message:string, embedFlag:boolean) { async createTag(userid:string, tagName:string, message:string, embedFlag:boolean) {
CacheServer.delete('tags'); CacheServer.delete('tags');
return await this.model.create({userid: userid, tagname: tagName, message: message.replace(/\\n/g, '\n'), embedFlag: embedFlag}); return await this.model.create({userid: userid, tagname: tagName, message: message.replace(/\\n/g, '\n'), embedFlag: embedFlag});

View File

@ -3,7 +3,7 @@ import TClient from '../client.js';
import MessageTool from '../helpers/MessageTool.js'; import MessageTool from '../helpers/MessageTool.js';
import DatabaseServer from '../components/DatabaseServer.js'; import DatabaseServer from '../components/DatabaseServer.js';
import {Model, DataTypes} from 'sequelize'; import {Model, DataTypes} from 'sequelize';
import {writeFileSync} from 'node:fs'; import {writeFileSync, readFileSync, existsSync} from 'node:fs';
import cron from 'node-cron'; import cron from 'node-cron';
import Logger from '../helpers/Logger.js'; import Logger from '../helpers/Logger.js';
@ -108,5 +108,17 @@ export class UserLevelsSvc {
} }
algorithm = (level:number)=>level*level*15; algorithm = (level:number)=>level*level*15;
// Algorithm for determining levels. If adjusting, recommended to only change the integer at the end of equation. // Algorithm for determining levels. If adjusting, recommended to only change the integer at the end of equation.
// Requires rank data to be reset if changed as it causes unexpected results.
// Deadge on 1.6k users in database...
async migrate() {
let file:string = 'src/userLevels.json';
if (!existsSync(file)) return Error(`File not found, have you tried checking if it exists? (${file})`);
await this.model.bulkCreate(JSON.parse(readFileSync(file, 'utf8')).map(x=>({
id: x._id,
messages: x.messages,
level: x.level,
pingToggle: x.notificationPing
})));
}
} }

View File

@ -441,7 +441,7 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"@types/node@npm:*": "@types/node@npm:*, @types/node@npm:20.10.5":
version: 20.10.5 version: 20.10.5
resolution: "@types/node@npm:20.10.5" resolution: "@types/node@npm:20.10.5"
dependencies: dependencies:
@ -450,15 +450,6 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"@types/node@npm:20.10.6":
version: 20.10.6
resolution: "@types/node@npm:20.10.6"
dependencies:
undici-types: "npm:~5.26.4"
checksum: 08471220d3cbbb6669835c4b78541edf5eface8f2c2e36c550cfa4ff73da73071c90e200a06359fac25d6564127597c23e178128058fb676824ec23d5178a017
languageName: node
linkType: hard
"@types/pg@npm:8.10.9": "@types/pg@npm:8.10.9":
version: 8.10.9 version: 8.10.9
resolution: "@types/pg@npm:8.10.9" resolution: "@types/pg@npm:8.10.9"
@ -757,7 +748,7 @@ __metadata:
"@octokit/rest": "npm:20.0.2" "@octokit/rest": "npm:20.0.2"
"@toast/tokenservice-client": "npm:1.0.6" "@toast/tokenservice-client": "npm:1.0.6"
"@types/ms": "npm:0.7.34" "@types/ms": "npm:0.7.34"
"@types/node": "npm:20.10.6" "@types/node": "npm:20.10.5"
"@types/node-cron": "npm:3.0.11" "@types/node-cron": "npm:3.0.11"
"@types/pg": "npm:8.10.9" "@types/pg": "npm:8.10.9"
"@types/sequelize": "npm:4.28.19" "@types/sequelize": "npm:4.28.19"
@ -772,7 +763,7 @@ __metadata:
pg-hstore: "npm:2.3.4" pg-hstore: "npm:2.3.4"
redis: "npm:4.6.12" redis: "npm:4.6.12"
sequelize: "npm:6.35.2" sequelize: "npm:6.35.2"
simple-git: "npm:3.22.0" simple-git: "npm:3.21.0"
systeminformation: "npm:5.21.22" systeminformation: "npm:5.21.22"
typescript: "npm:5.3.3" typescript: "npm:5.3.3"
undici: "npm:6.2.1" undici: "npm:6.2.1"
@ -1963,14 +1954,14 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"simple-git@npm:3.22.0": "simple-git@npm:3.21.0":
version: 3.22.0 version: 3.21.0
resolution: "simple-git@npm:3.22.0" resolution: "simple-git@npm:3.21.0"
dependencies: dependencies:
"@kwsites/file-exists": "npm:^1.1.1" "@kwsites/file-exists": "npm:^1.1.1"
"@kwsites/promise-deferred": "npm:^1.1.1" "@kwsites/promise-deferred": "npm:^1.1.1"
debug: "npm:^4.3.4" debug: "npm:^4.3.4"
checksum: 309e7f0b73550f99949c0c6cfd4b4799ec0452fc4835dc440f89ec9351fe553c979c4e2bf7a772308e608697d3a27512281fbc64df0328a73607641f389b0aaf checksum: 6b644151a41facdafdb6ef97f52125cfcfa61e1aa4bed1f25249d4ae71f9ddaffd371919f9dd0cc3fdb16db248d98b389f80ae4f2a416d924f23e6cee3b2f813
languageName: node languageName: node
linkType: hard linkType: hard