use ShewenyClient instead of Container

This commit is contained in:
Aymeric GUERACAGUE 2022-07-03 21:43:59 +02:00
parent 86ce08bd0a
commit c0a238d66a
Signed by: Superkooka
GPG Key ID: F78F2B172E894865
2 changed files with 11 additions and 21 deletions

View File

@ -1,13 +0,0 @@
export class Container {
static container: Container
instance: Record<string, any> = []
set<T>(key: string, value: T) {
this.instance[key] = value
}
get<T>(key: string): T {
return this.instance[key]
}
}

View File

@ -1,5 +1,4 @@
import { ShewenyClient } from "sheweny"; import { ShewenyClient } from "sheweny";
import {Container} from "./container";
import {Config} from "./config"; import {Config} from "./config";
import * as TOML from "toml"; import * as TOML from "toml";
import * as fs from "fs"; import * as fs from "fs";
@ -7,12 +6,16 @@ import * as fs from "fs";
const configurationFile = fs.readFileSync("./config.toml").toString() const configurationFile = fs.readFileSync("./config.toml").toString()
const configuration = TOML.parse(configurationFile) as Config const configuration = TOML.parse(configurationFile) as Config
const container = new Container() class Client extends ShewenyClient {
container.set("config", configuration) readonly config = configuration
Container.container = container
const client = new ShewenyClient({ constructor() {
super({
intents: ["GUILDS", "GUILD_MEMBERS", "GUILD_MESSAGES"], intents: ["GUILDS", "GUILD_MEMBERS", "GUILD_MESSAGES"],
}); });
client.login(configuration.token) this.login(this.config.token)
}
}
new Client();