gambling-bot-shared 0.1.52 → 0.1.53

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/README.MD CHANGED
@@ -40,7 +40,7 @@ Bootstrap all three repos in one step:
40
40
  curl -fsSL https://raw.githubusercontent.com/krouskystepan/gambling-bot-shared/main/scripts/setup-workspace.sh | bash
41
41
  ```
42
42
 
43
- See [docs/LOCAL_DEVELOPMENT.md](./docs/LOCAL_DEVELOPMENT.md) for the local linking workflow, debugging commands, and release process.
43
+ See [docs/LOCAL_DEVELOPMENT.md](./docs/LOCAL_DEVELOPMENT.md) for the local linking workflow, debugging commands, and CI release process.
44
44
 
45
45
  ## GitHub / CI
46
46
 
@@ -95,4 +95,14 @@ export declare const defaultCasinoSettings: {
95
95
  maxBet: number;
96
96
  minBet: number;
97
97
  };
98
+ winAnnouncements: {
99
+ plinkoMinMultiplier: number;
100
+ goldenJackpotMinMultiplier: number;
101
+ slotsMinMultiplier: number;
102
+ lotteryMinMultiplier: number;
103
+ rouletteMinMultiplier: number;
104
+ blackjackMinMultiplier: number;
105
+ diceMinMultiplier: number;
106
+ coinflipMinMultiplier: number;
107
+ };
98
108
  };
@@ -8,7 +8,18 @@ exports.readableGameValueNames = [
8
8
  { name: 'Win Multipliers (x)', value: 'winMultipliers' },
9
9
  { name: 'Casino House Cut (%)', value: 'casinoCut' },
10
10
  { name: 'One-In Chance (e.g. 1 in 10,000)', value: 'oneInChance' },
11
- { name: 'Symbol Weights', value: 'symbolWeights' }
11
+ { name: 'Symbol Weights', value: 'symbolWeights' },
12
+ { name: 'Plinko Minimum Multiplier', value: 'plinkoMinMultiplier' },
13
+ {
14
+ name: 'Golden Jackpot Minimum Multiplier',
15
+ value: 'goldenJackpotMinMultiplier'
16
+ },
17
+ { name: 'Slots Minimum Multiplier', value: 'slotsMinMultiplier' },
18
+ { name: 'Dice Minimum Multiplier', value: 'diceMinMultiplier' },
19
+ { name: 'Coin Flip Minimum Multiplier', value: 'coinflipMinMultiplier' },
20
+ { name: 'Lottery Minimum Multiplier', value: 'lotteryMinMultiplier' },
21
+ { name: 'Roulette Minimum Multiplier', value: 'rouletteMinMultiplier' },
22
+ { name: 'Blackjack Minimum Multiplier', value: 'blackjackMinMultiplier' }
12
23
  ];
13
24
  exports.readableGameNames = [
14
25
  { name: 'Dice', value: 'dice' },
@@ -21,7 +32,8 @@ exports.readableGameNames = [
21
32
  { name: 'Blackjack', value: 'blackjack' },
22
33
  { name: 'Prediction', value: 'prediction' },
23
34
  { name: 'Raffle', value: 'raffle' },
24
- { name: 'Plinko', value: 'plinko' }
35
+ { name: 'Plinko', value: 'plinko' },
36
+ { name: 'Win Announcements', value: 'winAnnouncements' }
25
37
  ];
26
38
  exports.defaultCasinoSettings = {
27
39
  dice: {
@@ -111,5 +123,15 @@ exports.defaultCasinoSettings = {
111
123
  },
112
124
  maxBet: 0,
113
125
  minBet: 0
126
+ },
127
+ winAnnouncements: {
128
+ plinkoMinMultiplier: 6,
129
+ goldenJackpotMinMultiplier: 1,
130
+ slotsMinMultiplier: 100,
131
+ lotteryMinMultiplier: 40,
132
+ rouletteMinMultiplier: 18,
133
+ blackjackMinMultiplier: 2.5,
134
+ diceMinMultiplier: 0,
135
+ coinflipMinMultiplier: 0
114
136
  }
115
137
  };
@@ -49,6 +49,15 @@ export declare const GuildConfigurationSchema: Schema<TGuildConfiguration, impor
49
49
  }, "id"> & {
50
50
  id: string;
51
51
  }> | undefined;
52
+ winAnnouncementsChannelId?: import("mongoose").SchemaDefinitionProperty<string, TGuildConfiguration, import("mongoose").Document<unknown, {}, TGuildConfiguration, {
53
+ id: string;
54
+ }, import("mongoose").ResolveSchemaOptions<import("mongoose").DefaultSchemaOptions>> & Omit<TGuildConfiguration & {
55
+ _id: import("mongoose").Types.ObjectId;
56
+ } & {
57
+ __v: number;
58
+ }, "id"> & {
59
+ id: string;
60
+ }> | undefined;
52
61
  predictionChannelIds?: import("mongoose").SchemaDefinitionProperty<{
53
62
  actions: string;
54
63
  logs: string;
@@ -171,6 +180,16 @@ export declare const GuildConfigurationSchema: Schema<TGuildConfiguration, impor
171
180
  maxBet: number;
172
181
  minBet: number;
173
182
  };
183
+ winAnnouncements: {
184
+ plinkoMinMultiplier: number;
185
+ goldenJackpotMinMultiplier: number;
186
+ slotsMinMultiplier: number;
187
+ lotteryMinMultiplier: number;
188
+ rouletteMinMultiplier: number;
189
+ blackjackMinMultiplier: number;
190
+ diceMinMultiplier: number;
191
+ coinflipMinMultiplier: number;
192
+ };
174
193
  }, TGuildConfiguration, import("mongoose").Document<unknown, {}, TGuildConfiguration, {
175
194
  id: string;
176
195
  }, import("mongoose").ResolveSchemaOptions<import("mongoose").DefaultSchemaOptions>> & Omit<TGuildConfiguration & {
@@ -24,6 +24,10 @@ exports.GuildConfigurationSchema = new mongoose_1.Schema({
24
24
  type: [String],
25
25
  default: []
26
26
  },
27
+ winAnnouncementsChannelId: {
28
+ type: String,
29
+ default: ''
30
+ },
27
31
  predictionChannelIds: {
28
32
  actions: {
29
33
  type: String,
@@ -5,6 +5,7 @@ export declare const atmChannelsFormSchema: z.ZodObject<{
5
5
  }, z.core.$strip>;
6
6
  export declare const casinoChannelsFormSchema: z.ZodObject<{
7
7
  casinoChannelIds: z.ZodArray<z.ZodString>;
8
+ winAnnouncementsChannelId: z.ZodString;
8
9
  }, z.core.$strip>;
9
10
  export declare const predictionChannelsFormSchema: z.ZodObject<{
10
11
  actions: z.ZodString;
@@ -21,6 +22,7 @@ export declare const channelsFormSchema: z.ZodObject<{
21
22
  }, z.core.$strip>;
22
23
  casino: z.ZodObject<{
23
24
  casinoChannelIds: z.ZodArray<z.ZodString>;
25
+ winAnnouncementsChannelId: z.ZodString;
24
26
  }, z.core.$strip>;
25
27
  prediction: z.ZodObject<{
26
28
  actions: z.ZodString;
@@ -95,6 +97,16 @@ export declare const casinoSettingsSchema: z.ZodObject<{
95
97
  minBet: z.ZodPipe<z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>, z.ZodTransform<number, string | number>>, z.ZodNumber>;
96
98
  maxBet: z.ZodPipe<z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>, z.ZodTransform<number, string | number>>, z.ZodNumber>;
97
99
  }, z.core.$strip>;
100
+ winAnnouncements: z.ZodObject<{
101
+ plinkoMinMultiplier: z.ZodPipe<z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>, z.ZodTransform<number, string | number>>, z.ZodNumber>;
102
+ goldenJackpotMinMultiplier: z.ZodPipe<z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>, z.ZodTransform<number, string | number>>, z.ZodNumber>;
103
+ slotsMinMultiplier: z.ZodPipe<z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>, z.ZodTransform<number, string | number>>, z.ZodNumber>;
104
+ lotteryMinMultiplier: z.ZodPipe<z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>, z.ZodTransform<number, string | number>>, z.ZodNumber>;
105
+ rouletteMinMultiplier: z.ZodPipe<z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>, z.ZodTransform<number, string | number>>, z.ZodNumber>;
106
+ blackjackMinMultiplier: z.ZodPipe<z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>, z.ZodTransform<number, string | number>>, z.ZodNumber>;
107
+ diceMinMultiplier: z.ZodPipe<z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>, z.ZodTransform<number, string | number>>, z.ZodNumber>;
108
+ coinflipMinMultiplier: z.ZodPipe<z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>, z.ZodTransform<number, string | number>>, z.ZodNumber>;
109
+ }, z.core.$strip>;
98
110
  }, z.core.$strip>;
99
111
  export declare const vipSettingsFormSchema: z.ZodObject<{
100
112
  roleOwnerId: z.ZodString;
@@ -8,23 +8,21 @@ const zod_1 = __importDefault(require("zod"));
8
8
  const bonusLimits_1 = require("../constants/bonusLimits");
9
9
  const commonTimezones_1 = require("../constants/commonTimezones");
10
10
  const plinkoConfig_1 = require("../constants/plinkoConfig");
11
- const NO_CHANNEL = 'At least one channel must be selected.';
12
11
  exports.atmChannelsFormSchema = zod_1.default.object({
13
- actions: zod_1.default.string().min(1, { message: NO_CHANNEL }),
14
- logs: zod_1.default.string().min(1, { message: NO_CHANNEL })
12
+ actions: zod_1.default.string(),
13
+ logs: zod_1.default.string()
15
14
  });
16
15
  exports.casinoChannelsFormSchema = zod_1.default.object({
17
- casinoChannelIds: zod_1.default
18
- .array(zod_1.default.string().min(1, { message: NO_CHANNEL }))
19
- .min(1, { message: NO_CHANNEL })
16
+ casinoChannelIds: zod_1.default.array(zod_1.default.string()),
17
+ winAnnouncementsChannelId: zod_1.default.string()
20
18
  });
21
19
  exports.predictionChannelsFormSchema = zod_1.default.object({
22
- actions: zod_1.default.string().min(1, { message: NO_CHANNEL }),
23
- logs: zod_1.default.string().min(1, { message: NO_CHANNEL })
20
+ actions: zod_1.default.string(),
21
+ logs: zod_1.default.string()
24
22
  });
25
23
  exports.raffleChannelsFormSchema = zod_1.default.object({
26
- actions: zod_1.default.string().min(1, { message: NO_CHANNEL }),
27
- logs: zod_1.default.string().min(1, { message: NO_CHANNEL })
24
+ actions: zod_1.default.string(),
25
+ logs: zod_1.default.string()
28
26
  });
29
27
  exports.channelsFormSchema = zod_1.default.object({
30
28
  atm: exports.atmChannelsFormSchema,
@@ -96,19 +94,29 @@ exports.casinoSettingsSchema = zod_1.default.object({
96
94
  .transform(plinkoConfig_1.normalizePlinkoBinMultipliers),
97
95
  minBet: num,
98
96
  maxBet: num
97
+ }),
98
+ winAnnouncements: zod_1.default.object({
99
+ plinkoMinMultiplier: num,
100
+ goldenJackpotMinMultiplier: num,
101
+ slotsMinMultiplier: num,
102
+ lotteryMinMultiplier: num,
103
+ rouletteMinMultiplier: num,
104
+ blackjackMinMultiplier: num,
105
+ diceMinMultiplier: num,
106
+ coinflipMinMultiplier: num
99
107
  })
100
108
  });
101
109
  exports.vipSettingsFormSchema = zod_1.default.object({
102
- roleOwnerId: zod_1.default.string().min(1, 'Select a Owner VIP role'),
103
- roleMemberId: zod_1.default.string().min(1, 'Select a Member VIP role'),
110
+ roleOwnerId: zod_1.default.string(),
111
+ roleMemberId: zod_1.default.string(),
104
112
  pricePerDay: zod_1.default.number().min(0, 'Must be ≥ 0'),
105
113
  pricePerCreate: zod_1.default.number().min(0, 'Must be ≥ 0'),
106
114
  pricePerAdditionalMember: zod_1.default.number().min(0, 'Must be ≥ 0'),
107
115
  maxMembers: zod_1.default.number().min(0, 'Must be ≥ 0'),
108
- categoryId: zod_1.default.string().min(1, 'Select a category')
116
+ categoryId: zod_1.default.string()
109
117
  });
110
118
  exports.managerRoleFormSchema = zod_1.default.object({
111
- managerRoleId: zod_1.default.string().min(1, 'Select a manager role')
119
+ managerRoleId: zod_1.default.string()
112
120
  });
113
121
  const bonusAmountSchema = zod_1.default
114
122
  .number()
@@ -9,6 +9,7 @@ export type TGuildConfiguration = {
9
9
  logs: string;
10
10
  };
11
11
  casinoChannelIds: string[];
12
+ winAnnouncementsChannelId: string;
12
13
  predictionChannelIds: {
13
14
  actions: string;
14
15
  logs: string;
@@ -5,9 +5,11 @@ export * from './generateBonusPreview';
5
5
  export * from './formatters';
6
6
  export * from './globalSettings';
7
7
  export * from './normalizeGlobalSettings';
8
+ export * from './normalizeCasinoSettings';
8
9
  export * from './guildTimezone';
9
10
  export * from './generateId';
10
11
  export * from './parseTimeToSeconds';
11
12
  export * from './validateBetAmount';
12
13
  export * from './bonusStreak';
13
14
  export * from './validatePredictionBet';
15
+ export * from './winAnnouncements';
@@ -21,9 +21,11 @@ __exportStar(require("./generateBonusPreview"), exports);
21
21
  __exportStar(require("./formatters"), exports);
22
22
  __exportStar(require("./globalSettings"), exports);
23
23
  __exportStar(require("./normalizeGlobalSettings"), exports);
24
+ __exportStar(require("./normalizeCasinoSettings"), exports);
24
25
  __exportStar(require("./guildTimezone"), exports);
25
26
  __exportStar(require("./generateId"), exports);
26
27
  __exportStar(require("./parseTimeToSeconds"), exports);
27
28
  __exportStar(require("./validateBetAmount"), exports);
28
29
  __exportStar(require("./bonusStreak"), exports);
29
30
  __exportStar(require("./validatePredictionBet"), exports);
31
+ __exportStar(require("./winAnnouncements"), exports);
@@ -0,0 +1,2 @@
1
+ import type { TCasinoSettings } from '../types';
2
+ export declare const normalizeCasinoSettings: (settings: Partial<TCasinoSettings> | null | undefined) => TCasinoSettings;
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.normalizeCasinoSettings = void 0;
4
+ const constants_1 = require("../constants");
5
+ const plinkoConfig_1 = require("../constants/plinkoConfig");
6
+ const isPlainObject = (value) => typeof value === 'object' && value !== null && !Array.isArray(value);
7
+ const deepMerge = (base, patch) => {
8
+ if (!patch)
9
+ return { ...base };
10
+ const result = { ...base };
11
+ for (const [key, patchValue] of Object.entries(patch)) {
12
+ const baseValue = base[key];
13
+ if (isPlainObject(baseValue) && isPlainObject(patchValue)) {
14
+ result[key] = deepMerge(baseValue, patchValue);
15
+ continue;
16
+ }
17
+ if (patchValue !== undefined) {
18
+ result[key] = patchValue;
19
+ }
20
+ }
21
+ return result;
22
+ };
23
+ const normalizeCasinoSettings = (settings) => {
24
+ const merged = deepMerge(constants_1.defaultCasinoSettings, settings);
25
+ return {
26
+ ...merged,
27
+ plinko: {
28
+ ...merged.plinko,
29
+ binMultipliers: (0, plinkoConfig_1.normalizePlinkoBinMultipliers)(merged.plinko.binMultipliers)
30
+ }
31
+ };
32
+ };
33
+ exports.normalizeCasinoSettings = normalizeCasinoSettings;
@@ -0,0 +1,4 @@
1
+ /** minMultiplier <= 0 disables announcements for that game */
2
+ export declare const shouldAnnounceByMultiplier: (multiplier: number, minMultiplier: number) => boolean;
3
+ export declare const shouldAnnouncePlinkoBall: (multiplier: number, plinkoMinMultiplier: number) => boolean;
4
+ export declare const shouldAnnounceGoldenJackpotHit: (winMultiplier: number, goldenJackpotMinMultiplier: number) => boolean;
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.shouldAnnounceGoldenJackpotHit = exports.shouldAnnouncePlinkoBall = exports.shouldAnnounceByMultiplier = void 0;
4
+ /** minMultiplier <= 0 disables announcements for that game */
5
+ const shouldAnnounceByMultiplier = (multiplier, minMultiplier) => minMultiplier > 0 && multiplier >= minMultiplier;
6
+ exports.shouldAnnounceByMultiplier = shouldAnnounceByMultiplier;
7
+ const shouldAnnouncePlinkoBall = (multiplier, plinkoMinMultiplier) => (0, exports.shouldAnnounceByMultiplier)(multiplier, plinkoMinMultiplier);
8
+ exports.shouldAnnouncePlinkoBall = shouldAnnouncePlinkoBall;
9
+ const shouldAnnounceGoldenJackpotHit = (winMultiplier, goldenJackpotMinMultiplier) => (0, exports.shouldAnnounceByMultiplier)(winMultiplier, goldenJackpotMinMultiplier);
10
+ exports.shouldAnnounceGoldenJackpotHit = shouldAnnounceGoldenJackpotHit;
package/package.json CHANGED
@@ -1,10 +1,14 @@
1
1
  {
2
2
  "name": "gambling-bot-shared",
3
- "version": "0.1.52",
3
+ "version": "0.1.53",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "license": "MIT",
7
7
  "type": "commonjs",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/krouskystepan/gambling-bot-shared.git"
11
+ },
8
12
  "files": [
9
13
  "dist"
10
14
  ],
@@ -37,9 +41,7 @@
37
41
  "unlink-local": "bash scripts/unlink-local.sh",
38
42
  "link-status": "bash scripts/shared-link-status.sh",
39
43
  "setup-workspace": "bash scripts/setup-workspace.sh",
40
- "release": "bash scripts/release.sh",
41
- "publish-and-bump-projects": "bash scripts/publish-to-npm.sh",
42
- "publish-to-npm": "bash scripts/publish-to-npm.sh"
44
+ "bump": "bash scripts/bump.sh"
43
45
  },
44
46
  "peerDependencies": {
45
47
  "mongoose": "^9.0.0"