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"],\
["@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/node", "npm:20.10.6"],\
["@types/node", "npm:20.10.5"],\
["@types/node-cron", "npm:3.0.11"],\
["@types/pg", "npm:8.10.9"],\
["@types/sequelize", "npm:4.28.19"],\
@ -45,7 +45,7 @@ const RAW_RUNTIME_STATE =
["pg-hstore", "npm:2.3.4"],\
["redis", "npm:4.6.12"],\
["sequelize", "virtual:20c353e2d6536e37339997f03975c6a660f4d296e664d291bd43620c6162cca8eb5ef90b0998dc9db75ff6862e5da587d0530bae26805f5fadc8f17aaa4ff794#npm:6.35.2"],\
["simple-git", "npm:3.22.0"],\
["simple-git", "npm:3.21.0"],\
["systeminformation", "npm:5.21.22"],\
["typescript", "patch:typescript@npm%3A5.3.3#optional!builtin<compat/typescript>::version=5.3.3&hash=e012d7"],\
["undici", "npm:6.2.1"]\
@ -644,14 +644,6 @@ const RAW_RUNTIME_STATE =
["undici-types", "npm:5.26.5"]\
],\
"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", [\
@ -1003,7 +995,7 @@ const RAW_RUNTIME_STATE =
["@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"],\
["@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/pg", "npm:8.10.9"],\
["@types/sequelize", "npm:4.28.19"],\
@ -1018,7 +1010,7 @@ const RAW_RUNTIME_STATE =
["pg-hstore", "npm:2.3.4"],\
["redis", "npm:4.6.12"],\
["sequelize", "virtual:20c353e2d6536e37339997f03975c6a660f4d296e664d291bd43620c6162cca8eb5ef90b0998dc9db75ff6862e5da587d0530bae26805f5fadc8f17aaa4ff794#npm:6.35.2"],\
["simple-git", "npm:3.22.0"],\
["simple-git", "npm:3.21.0"],\
["systeminformation", "npm:5.21.22"],\
["typescript", "patch:typescript@npm%3A5.3.3#optional!builtin<compat/typescript>::version=5.3.3&hash=e012d7"],\
["undici", "npm:6.2.1"]\
@ -2406,10 +2398,10 @@ const RAW_RUNTIME_STATE =
}]\
]],\
["simple-git", [\
["npm:3.22.0", {\
"packageLocation": "./.yarn/cache/simple-git-npm-3.22.0-42ea3caec2-309e7f0b73.zip/node_modules/simple-git/",\
["npm:3.21.0", {\
"packageLocation": "./.yarn/cache/simple-git-npm-3.21.0-692f82a4a3-6b644151a4.zip/node_modules/simple-git/",\
"packageDependencies": [\
["simple-git", "npm:3.22.0"],\
["simple-git", "npm:3.21.0"],\
["@kwsites/file-exists", "npm:1.1.1"],\
["@kwsites/promise-deferred", "npm:1.1.1"],\
["debug", "virtual:428f325a939c2653ad822eb3d75efb02ac311523dd0d4f9645afc39ea00bd86eceac35a9d59c9b6977d76b670a4ef0ae057ea572338a44729aa592711a8c05a3#npm:4.3.4"]\

View File

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

View File

@ -1,6 +1,6 @@
{
"configName": "Daggerbot",
"embedColor": "#0052cf",
"embedColor": "#ffffff",
"embedColorBackup": "#0052cf",
"embedColorGreen": "#57f287",
"embedColorYellow": "#ffea00",
@ -8,10 +8,9 @@
"embedColorInvis": "#2f3136",
"embedColorBCA": "#ff69b4",
"embedColorXmas": "#ffffff",
"LRSstart": 1704067200631,
"LRSstart": 1661236321433,
"whitelistedServers": [
"929807948748832798",
"468835415093411861"
"929807948748832798", "468835415093411861"
],
"botSwitches": {
"dailyMsgsBackup": true,
@ -24,15 +23,11 @@
"autores": true
},
"botPresence": {
"activities": [
{
"name": "Today is January!",
"url": "https://www.youtube.com/watch?v=UPSSUSLlwjY",
"type": 1
}
],
"status": "online"
},
"activities": [
{"name": "Today is January!", "url": "https://www.youtube.com/watch?v=UPSSUSLlwjY", "type": 1}
],
"status": "online"
},
"whitelist": [
"190407856527376384",
"215497515934416896",

View File

@ -7,6 +7,7 @@ import {Model, DataTypes} from 'sequelize';
import CacheServer from '../components/CacheServer.js';
import MessageTool from '../helpers/MessageTool.js';
import Formatters from '../helpers/Formatters.js';
import {readFileSync, existsSync} from 'node:fs';
class punishments extends Model {
declare public case_id: number;
@ -78,6 +79,23 @@ export class PunishmentsSvc {
});
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) {
const findCase = this.findCase(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 DatabaseServer from '../components/DatabaseServer.js';
import {Model, DataTypes} from 'sequelize';
import {readFileSync, existsSync} from 'node:fs';
import {ChatInputCommandInteraction, Snowflake} from 'discord.js';
class tagsystem extends Model {
@ -50,6 +51,17 @@ export class TagSystemSvc {
});
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) {
CacheServer.delete('tags');
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 DatabaseServer from '../components/DatabaseServer.js';
import {Model, DataTypes} from 'sequelize';
import {writeFileSync} from 'node:fs';
import {writeFileSync, readFileSync, existsSync} from 'node:fs';
import cron from 'node-cron';
import Logger from '../helpers/Logger.js';
@ -108,5 +108,17 @@ export class UserLevelsSvc {
}
algorithm = (level:number)=>level*level*15;
// 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
linkType: hard
"@types/node@npm:*":
"@types/node@npm:*, @types/node@npm:20.10.5":
version: 20.10.5
resolution: "@types/node@npm:20.10.5"
dependencies:
@ -450,15 +450,6 @@ __metadata:
languageName: node
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":
version: 8.10.9
resolution: "@types/pg@npm:8.10.9"
@ -757,7 +748,7 @@ __metadata:
"@octokit/rest": "npm:20.0.2"
"@toast/tokenservice-client": "npm:1.0.6"
"@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/pg": "npm:8.10.9"
"@types/sequelize": "npm:4.28.19"
@ -772,7 +763,7 @@ __metadata:
pg-hstore: "npm:2.3.4"
redis: "npm:4.6.12"
sequelize: "npm:6.35.2"
simple-git: "npm:3.22.0"
simple-git: "npm:3.21.0"
systeminformation: "npm:5.21.22"
typescript: "npm:5.3.3"
undici: "npm:6.2.1"
@ -1963,14 +1954,14 @@ __metadata:
languageName: node
linkType: hard
"simple-git@npm:3.22.0":
version: 3.22.0
resolution: "simple-git@npm:3.22.0"
"simple-git@npm:3.21.0":
version: 3.21.0
resolution: "simple-git@npm:3.21.0"
dependencies:
"@kwsites/file-exists": "npm:^1.1.1"
"@kwsites/promise-deferred": "npm:^1.1.1"
debug: "npm:^4.3.4"
checksum: 309e7f0b73550f99949c0c6cfd4b4799ec0452fc4835dc440f89ec9351fe553c979c4e2bf7a772308e608697d3a27512281fbc64df0328a73607641f389b0aaf
checksum: 6b644151a41facdafdb6ef97f52125cfcfa61e1aa4bed1f25249d4ae71f9ddaffd371919f9dd0cc3fdb16db248d98b389f80ae4f2a416d924f23e6cee3b2f813
languageName: node
linkType: hard