nyx-bot-client 0.0.2 → 0.0.3

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.
package/.env.sample CHANGED
@@ -1,4 +1,8 @@
1
1
  BROKER_MYSQL_USER=
2
2
  BROKER_MYSQL_NAME=
3
3
  BROKER_MYSQL_HOST=
4
+ BROKER_MYSQL_PORT=
4
5
  BROKER_MYSQL_PASS=
6
+
7
+ BROKER_REDIS_HOST=
8
+ BROKER_REDIS_PORT=
package/bun.lock CHANGED
@@ -11,7 +11,7 @@
11
11
  "mysql2": "^3.15.0",
12
12
  "redis": "^5.8.2",
13
13
  "ts-debounce": "^4.0.0",
14
- "zod": "^4.1.9",
14
+ "zod": "^4.1.11",
15
15
  },
16
16
  "devDependencies": {
17
17
  "@types/bun": "latest",
@@ -96,7 +96,7 @@
96
96
 
97
97
  "undici-types": ["undici-types@7.12.0", "", {}, "sha512-goOacqME2GYyOZZfb5Lgtu+1IDmAlAEu5xnD3+xTzS10hT0vzpf0SPjkXwAw9Jm+4n/mQGDP3LO8CPbYROeBfQ=="],
98
98
 
99
- "zod": ["zod@4.1.9", "", {}, "sha512-HI32jTq0AUAC125z30E8bQNz0RQ+9Uc+4J7V97gLYjZVKRjeydPgGt6dvQzFrav7MYOUGFqqOGiHpA/fdbd0cQ=="],
99
+ "zod": ["zod@4.1.11", "", {}, "sha512-WPsqwxITS2tzx1bzhIKsEs19ABD5vmCVa4xBo2tq/SrV4RNZtfws1EnCWQXM6yh8bD08a1idvkB5MZSBiZsjwg=="],
100
100
 
101
101
  "bun-types/@types/node": ["@types/node@24.0.4", "", { "dependencies": { "undici-types": "~7.8.0" } }, "sha512-ulyqAkrhnuNq9pB76DRBTkcS6YsmDALy6Ua63V8OhrOBgbcYt6IOdzpw5P1+dyRIyMerzLkeYWBeOXPpA9GMAA=="],
102
102
 
@@ -12,7 +12,11 @@ const envScheme = z.object({
12
12
  BROKER_MYSQL_USER: z.string().nonempty(),
13
13
  BROKER_MYSQL_NAME: z.string().nonempty(),
14
14
  BROKER_MYSQL_PASS: z.string().nonempty(),
15
- BROKER_MYSQL_HOST: z.string().nonempty(),
15
+ BROKER_MYSQL_HOST: z.string().nonempty().default("127.0.0.1"),
16
+ BROKER_MYSQL_PORT: z.coerce.number().default(3306),
17
+
18
+ BROKER_REDIS_HOST: z.string().nonempty().default("127.0.0.1"),
19
+ BROKER_REDIS_PORT: z.coerce.number().default(6379),
16
20
  });
17
21
 
18
22
  const env: z.infer<typeof envScheme> = envScheme.parse(
@@ -43,7 +47,12 @@ const db = new Kysely<{
43
47
  }),
44
48
  });
45
49
 
46
- const redis = createClient();
50
+ const redis = createClient({
51
+ socket: {
52
+ host: env.BROKER_REDIS_HOST,
53
+ port: env.BROKER_REDIS_PORT,
54
+ }
55
+ });
47
56
  await redis.connect();
48
57
 
49
58
  redis.subscribe("nyx-action", async (input) => {
package/nyx-client.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { createClient } from "redis";
1
+ import { createClient, type RedisClientType } from "redis";
2
2
  import { z } from "zod";
3
3
  import type { EventTypes } from "./@types";
4
4
  import type {
@@ -18,6 +18,10 @@ type NyxConfig = {
18
18
  onStartup?: () => Promise<void>;
19
19
  onShutdown?: () => Promise<void>;
20
20
  benchmark?: boolean;
21
+ redis?: {
22
+ host?: string;
23
+ port?: number;
24
+ };
21
25
  };
22
26
 
23
27
  class NyxClient {
@@ -27,9 +31,16 @@ class NyxClient {
27
31
  public injections: BotInjections | undefined;
28
32
  public benchmark: boolean | undefined;
29
33
 
30
- private redis = createClient();
34
+ private redis: RedisClientType | undefined;
31
35
 
32
36
  public async initialize(config: NyxConfig) {
37
+ this.redis = createClient({
38
+ socket: {
39
+ host: config.redis?.host ?? "127.0.0.1",
40
+ port: config.redis?.port ?? 6379,
41
+ },
42
+ });
43
+
33
44
  this.botConfig = z
34
45
  .object({
35
46
  username: z.string().nonempty(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nyx-bot-client",
3
- "version": "0.0.2",
3
+ "version": "0.0.3",
4
4
  "module": "index.ts",
5
5
  "type": "module",
6
6
  "devDependencies": {
@@ -17,6 +17,6 @@
17
17
  "mysql2": "^3.15.0",
18
18
  "redis": "^5.8.2",
19
19
  "ts-debounce": "^4.0.0",
20
- "zod": "^4.1.9"
20
+ "zod": "^4.1.11"
21
21
  }
22
22
  }