seyfert 2.2.1-dev-13162061448.0 → 2.2.1-dev-13217777411.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -13,13 +13,20 @@ export declare class LangsHandler extends BaseHandler {
13
13
  get(locale?: string): import("..").DefaultLocale;
14
14
  };
15
15
  load(dir: string): Promise<void>;
16
- parse(file: EventInstance): void;
17
- set(instances: EventInstance[]): void;
18
- reload(lang: string): Promise<false | Record<string, any> | null>;
16
+ parse(file: LangInstance): void;
17
+ set(instances: LangInstance[]): void;
18
+ reload(lang: string): Promise<false | {
19
+ file: Record<string, any>;
20
+ locale: string;
21
+ } | null>;
19
22
  reloadAll(stopIfFail?: boolean): Promise<void>;
20
- onFile(_locale: string, file: FileLoaded<Record<string, any>>): Record<string, any> | false;
23
+ onFile(locale: string, file: FileLoaded<Record<string, any>>): {
24
+ file: Record<string, any>;
25
+ locale: string;
26
+ } | false;
21
27
  }
22
- export type EventInstance = {
28
+ export type LangInstance = {
23
29
  name: string;
24
30
  file: Record<string, any>;
31
+ path: string;
25
32
  };
@@ -38,12 +38,13 @@ class LangsHandler extends common_1.BaseHandler {
38
38
  }
39
39
  }
40
40
  parse(file) {
41
- const locale = file.name.split('.').slice(0, -1).join('.') || file.name;
42
- const result = this.onFile(locale, file.file);
41
+ const oldLocale = file.name.split('.').slice(0, -1).join('.') || file.name;
42
+ const result = this.onFile(oldLocale, file.file);
43
+ if (!result)
44
+ return;
43
45
  if ('path' in file)
44
- this.__paths[locale] = file.path;
45
- if (result)
46
- this.values[locale] = result;
46
+ this.__paths[result.locale] = file.path;
47
+ this.values[result.locale] = result.file;
47
48
  }
48
49
  set(instances) {
49
50
  for (const i of instances) {
@@ -71,8 +72,13 @@ class LangsHandler extends common_1.BaseHandler {
71
72
  }
72
73
  }
73
74
  }
74
- onFile(_locale, file) {
75
- return file.default ?? false;
75
+ onFile(locale, file) {
76
+ return file.default
77
+ ? {
78
+ file: file.default,
79
+ locale,
80
+ }
81
+ : false;
76
82
  }
77
83
  }
78
84
  exports.LangsHandler = LangsHandler;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "seyfert",
3
- "version": "2.2.1-dev-13162061448.0",
3
+ "version": "2.2.1-dev-13217777411.0",
4
4
  "description": "The most advanced framework for discord bots",
5
5
  "main": "./lib/index.js",
6
6
  "module": "./lib/index.js",