diff --git a/src/models/punishments.ts b/src/models/punishments.ts index ca1dbf1..130d0b9 100644 --- a/src/models/punishments.ts +++ b/src/models/punishments.ts @@ -7,7 +7,6 @@ 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; @@ -79,23 +78,6 @@ 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}}); diff --git a/src/models/tagSystem.ts b/src/models/tagSystem.ts index b032c3a..929905b 100644 --- a/src/models/tagSystem.ts +++ b/src/models/tagSystem.ts @@ -3,7 +3,6 @@ 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 { @@ -51,17 +50,6 @@ 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}); diff --git a/src/models/userLevels.ts b/src/models/userLevels.ts index c53c9ba..58b0e93 100644 --- a/src/models/userLevels.ts +++ b/src/models/userLevels.ts @@ -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, readFileSync, existsSync} from 'node:fs'; +import {writeFileSync} from 'node:fs'; import cron from 'node-cron'; import Logger from '../helpers/Logger.js'; @@ -108,17 +108,5 @@ 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. - - // 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 - }))); - } + // Requires rank data to be reset if changed as it causes unexpected results. }