Update Font system

This commit is contained in:
Dragon Fire
2024-05-01 23:14:31 -04:00
parent 3610ee6f70
commit ae59abaf71
8 changed files with 39 additions and 28 deletions
+2 -17
View File
@@ -1,14 +1,10 @@
const CommandClient = require('../framework/Client');
const request = require('node-superfetch');
const { Collection } = require('@discordjs/collection');
const winston = require('winston');
const fontFinder = require('font-finder');
const moment = require('moment-timezone');
const fs = require('fs');
const path = require('path');
const Redis = require('./Redis');
const Tensorflow = require('./Tensorflow');
const Font = require('./Font');
const FontManager = require('./fonts/FontManager');
const PhoneManager = require('./phone/PhoneManager');
const TimerManager = require('./remind/TimerManager');
const PokemonStore = require('./pokemon/PokemonStore');
@@ -26,7 +22,7 @@ module.exports = class XiaoClient extends CommandClient {
winston.format.printf(log => `[${log.timestamp}] [${log.level.toUpperCase()}]: ${log.message}`)
)
});
this.fonts = new Collection();
this.fonts = new FontManager(this);
this.redis = Redis ? Redis.db : null;
this.timers = new TimerManager(this);
this.pokemon = new PokemonStore();
@@ -38,17 +34,6 @@ module.exports = class XiaoClient extends CommandClient {
this.adultSiteList = null;
}
async registerFontsIn(filepath) {
const files = fs.readdirSync(filepath);
for (const file of files) {
const metadata = await fontFinder.get(path.join(filepath, file));
const font = new Font(path.join(filepath, file), file, metadata);
this.fonts.set(file, font);
font.register();
}
return this.fonts;
}
setTimezones() {
moment.tz.link('America/Vancouver|Neopia');
moment.tz.link('America/Los_Angeles|Discord');