mirror of
https://github.com/Hessenuk/DiscordTickets.git
synced 2025-09-05 17:51:27 +03:00
Settings, encryption, logging
This commit is contained in:
@@ -2,9 +2,14 @@ const { Client: FrameworkClient }= require('@eartharoid/dbf');
|
||||
const { Intents } = require('discord.js');
|
||||
const { PrismaClient } = require('@prisma/client');
|
||||
const Keyv = require('keyv');
|
||||
const I18n = require('@eartharoid/i18n');
|
||||
const fs = require('fs');
|
||||
const { join } = require('path');
|
||||
const YAML = require('yaml');
|
||||
const middleware = require('./lib/prisma');
|
||||
|
||||
module.exports = class Client extends FrameworkClient {
|
||||
constructor() {
|
||||
constructor(config, log) {
|
||||
super({
|
||||
intents: [
|
||||
Intents.FLAGS.GUILDS,
|
||||
@@ -12,11 +17,26 @@ module.exports = class Client extends FrameworkClient {
|
||||
Intents.FLAGS.GUILD_MESSAGES,
|
||||
],
|
||||
});
|
||||
|
||||
const locales = {};
|
||||
fs.readdirSync(join(__dirname, 'i18n'))
|
||||
.filter(file => file.endsWith('.yml'))
|
||||
.forEach(file => {
|
||||
const data = fs.readFileSync(join(__dirname, 'i18n/' + file), { encoding: 'utf8' });
|
||||
const name = file.slice(0, file.length - 4);
|
||||
locales[name] = YAML.parse(data);
|
||||
});
|
||||
|
||||
/** @type {I18n} */
|
||||
this.i18n = new I18n('en-GB', locales);
|
||||
this.config = config;
|
||||
this.log = log;
|
||||
}
|
||||
|
||||
async login(token) {
|
||||
/** @type {PrismaClient} */
|
||||
this.prisma = new PrismaClient();
|
||||
// this.prisma.$use((params, next) => {})
|
||||
this.prisma.$use(middleware);
|
||||
this.keyv = new Keyv();
|
||||
return super.login(token);
|
||||
}
|
||||
|
Reference in New Issue
Block a user