gambling-bot-shared 0.1.52 → 0.1.54
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 +1 -1
- package/dist/constants/casinoGames.d.ts +3 -0
- package/dist/constants/casinoGames.js +5 -0
- package/dist/constants/defaultConfig.d.ts +10 -0
- package/dist/constants/defaultConfig.js +24 -2
- package/dist/constants/index.d.ts +1 -0
- package/dist/constants/index.js +1 -0
- package/dist/mongoose/atmRequest.schema.d.ts +20 -2
- package/dist/mongoose/atmRequest.schema.js +4 -1
- package/dist/mongoose/guildConfiguration.schema.d.ts +19 -0
- package/dist/mongoose/guildConfiguration.schema.js +4 -0
- package/dist/mongoose/prediction.schema.d.ts +1 -1
- package/dist/mongoose/prediction.schema.js +3 -2
- package/dist/mongoose/transaction.schema.d.ts +1 -1
- package/dist/schemas/forms.d.ts +12 -0
- package/dist/schemas/forms.js +22 -14
- package/dist/types/atmRequest.d.ts +4 -2
- package/dist/types/guildConfiguration.d.ts +1 -0
- package/dist/types/prediction.d.ts +2 -1
- package/dist/types/transaction.d.ts +5 -1
- package/dist/utils/bonusStreak.d.ts +1 -0
- package/dist/utils/bonusStreak.js +10 -1
- package/dist/utils/calculateBonusReward.d.ts +1 -0
- package/dist/utils/calculateBonusReward.js +4 -3
- package/dist/utils/calculateRTP.js +7 -2
- package/dist/utils/formatters.d.ts +3 -0
- package/dist/utils/formatters.js +8 -1
- package/dist/utils/index.d.ts +2 -0
- package/dist/utils/index.js +2 -0
- package/dist/utils/normalizeCasinoSettings.d.ts +2 -0
- package/dist/utils/normalizeCasinoSettings.js +33 -0
- package/dist/utils/winAnnouncements.d.ts +4 -0
- package/dist/utils/winAnnouncements.js +10 -0
- package/package.json +7 -5
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
|
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CASINO_GAME_IDS = void 0;
|
|
4
|
+
const defaultConfig_1 = require("./defaultConfig");
|
|
5
|
+
exports.CASINO_GAME_IDS = Object.keys(defaultConfig_1.defaultCasinoSettings).filter((key) => key !== 'winAnnouncements');
|
|
@@ -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
|
};
|
package/dist/constants/index.js
CHANGED
|
@@ -24,4 +24,5 @@ __exportStar(require("./rouletteConfig"), exports);
|
|
|
24
24
|
__exportStar(require("./gameRecordFields"), exports);
|
|
25
25
|
__exportStar(require("./plinkoConfig"), exports);
|
|
26
26
|
__exportStar(require("./transaction"), exports);
|
|
27
|
+
__exportStar(require("./casinoGames"), exports);
|
|
27
28
|
__exportStar(require("./blackjack"), exports);
|
|
@@ -100,7 +100,7 @@ export declare const AtmRequestSchema: Schema<TAtmRequest, import("mongoose").Mo
|
|
|
100
100
|
}, "id"> & {
|
|
101
101
|
id: string;
|
|
102
102
|
}> | undefined;
|
|
103
|
-
|
|
103
|
+
notes?: import("mongoose").SchemaDefinitionProperty<string | undefined, TAtmRequest, import("mongoose").Document<unknown, {}, TAtmRequest, {
|
|
104
104
|
id: string;
|
|
105
105
|
}, import("mongoose").ResolveSchemaOptions<import("mongoose").DefaultSchemaOptions>> & Omit<TAtmRequest & {
|
|
106
106
|
_id: import("mongoose").Types.ObjectId;
|
|
@@ -109,7 +109,25 @@ export declare const AtmRequestSchema: Schema<TAtmRequest, import("mongoose").Mo
|
|
|
109
109
|
}, "id"> & {
|
|
110
110
|
id: string;
|
|
111
111
|
}> | undefined;
|
|
112
|
-
|
|
112
|
+
logChannelId?: import("mongoose").SchemaDefinitionProperty<string | undefined, TAtmRequest, import("mongoose").Document<unknown, {}, TAtmRequest, {
|
|
113
|
+
id: string;
|
|
114
|
+
}, import("mongoose").ResolveSchemaOptions<import("mongoose").DefaultSchemaOptions>> & Omit<TAtmRequest & {
|
|
115
|
+
_id: import("mongoose").Types.ObjectId;
|
|
116
|
+
} & {
|
|
117
|
+
__v: number;
|
|
118
|
+
}, "id"> & {
|
|
119
|
+
id: string;
|
|
120
|
+
}> | undefined;
|
|
121
|
+
logMessageId?: import("mongoose").SchemaDefinitionProperty<string | undefined, TAtmRequest, import("mongoose").Document<unknown, {}, TAtmRequest, {
|
|
122
|
+
id: string;
|
|
123
|
+
}, import("mongoose").ResolveSchemaOptions<import("mongoose").DefaultSchemaOptions>> & Omit<TAtmRequest & {
|
|
124
|
+
_id: import("mongoose").Types.ObjectId;
|
|
125
|
+
} & {
|
|
126
|
+
__v: number;
|
|
127
|
+
}, "id"> & {
|
|
128
|
+
id: string;
|
|
129
|
+
}> | undefined;
|
|
130
|
+
meta?: import("mongoose").SchemaDefinitionProperty<Record<string, unknown> | undefined, TAtmRequest, import("mongoose").Document<unknown, {}, TAtmRequest, {
|
|
113
131
|
id: string;
|
|
114
132
|
}, import("mongoose").ResolveSchemaOptions<import("mongoose").DefaultSchemaOptions>> & Omit<TAtmRequest & {
|
|
115
133
|
_id: import("mongoose").Types.ObjectId;
|
|
@@ -18,6 +18,9 @@ exports.AtmRequestSchema = new mongoose_1.Schema({
|
|
|
18
18
|
},
|
|
19
19
|
handledBy: { type: String },
|
|
20
20
|
handledAt: { type: Date },
|
|
21
|
+
notes: { type: String },
|
|
21
22
|
logChannelId: { type: String },
|
|
22
|
-
logMessageId: { type: String }
|
|
23
|
+
logMessageId: { type: String },
|
|
24
|
+
meta: { type: mongoose_1.Schema.Types.Mixed }
|
|
23
25
|
}, { timestamps: true });
|
|
26
|
+
exports.AtmRequestSchema.index({ guildId: 1, status: 1, createdAt: -1 });
|
|
@@ -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 & {
|
|
@@ -73,7 +73,7 @@ export declare const PredictionSchema: Schema<TPrediction, import("mongoose").Mo
|
|
|
73
73
|
}, "id"> & {
|
|
74
74
|
id: string;
|
|
75
75
|
}> | undefined;
|
|
76
|
-
status?: import("mongoose").SchemaDefinitionProperty<"active" | "ended" | "paid" | "canceled", TPrediction, import("mongoose").Document<unknown, {}, TPrediction, {
|
|
76
|
+
status?: import("mongoose").SchemaDefinitionProperty<"active" | "ended" | "paying" | "paid" | "canceled", TPrediction, import("mongoose").Document<unknown, {}, TPrediction, {
|
|
77
77
|
id: string;
|
|
78
78
|
}, import("mongoose").ResolveSchemaOptions<import("mongoose").DefaultSchemaOptions>> & Omit<TPrediction & {
|
|
79
79
|
_id: import("mongoose").Types.ObjectId;
|
|
@@ -30,14 +30,15 @@ exports.PredictionSchema = new mongoose_1.Schema({
|
|
|
30
30
|
bets: [
|
|
31
31
|
{
|
|
32
32
|
userId: { type: String, required: true },
|
|
33
|
-
amount: { type: Number, required: true }
|
|
33
|
+
amount: { type: Number, required: true },
|
|
34
|
+
betId: { type: String, required: true }
|
|
34
35
|
}
|
|
35
36
|
]
|
|
36
37
|
}
|
|
37
38
|
],
|
|
38
39
|
status: {
|
|
39
40
|
type: String,
|
|
40
|
-
enum: ['active', 'ended', 'paid', 'canceled'],
|
|
41
|
+
enum: ['active', 'ended', 'paying', 'paid', 'canceled'],
|
|
41
42
|
default: 'active'
|
|
42
43
|
},
|
|
43
44
|
autolock: {
|
|
@@ -64,7 +64,7 @@ export declare const TransactionSchema: Schema<TTransaction, import("mongoose").
|
|
|
64
64
|
}, "id"> & {
|
|
65
65
|
id: string;
|
|
66
66
|
}> | undefined;
|
|
67
|
-
meta?: import("mongoose").SchemaDefinitionProperty<
|
|
67
|
+
meta?: import("mongoose").SchemaDefinitionProperty<import("../types").TransactionMeta | undefined, TTransaction, import("mongoose").Document<unknown, {}, TTransaction, {
|
|
68
68
|
id: string;
|
|
69
69
|
}, import("mongoose").ResolveSchemaOptions<import("mongoose").DefaultSchemaOptions>> & Omit<TTransaction & {
|
|
70
70
|
_id: import("mongoose").Types.ObjectId;
|
package/dist/schemas/forms.d.ts
CHANGED
|
@@ -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;
|
package/dist/schemas/forms.js
CHANGED
|
@@ -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()
|
|
14
|
-
logs: zod_1.default.string()
|
|
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
|
-
|
|
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()
|
|
23
|
-
logs: zod_1.default.string()
|
|
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()
|
|
27
|
-
logs: zod_1.default.string()
|
|
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()
|
|
103
|
-
roleMemberId: zod_1.default.string()
|
|
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()
|
|
116
|
+
categoryId: zod_1.default.string()
|
|
109
117
|
});
|
|
110
118
|
exports.managerRoleFormSchema = zod_1.default.object({
|
|
111
|
-
managerRoleId: zod_1.default.string()
|
|
119
|
+
managerRoleId: zod_1.default.string()
|
|
112
120
|
});
|
|
113
121
|
const bonusAmountSchema = zod_1.default
|
|
114
122
|
.number()
|
|
@@ -8,8 +8,10 @@ export type TAtmRequest = {
|
|
|
8
8
|
status: 'pending' | 'approved' | 'rejected';
|
|
9
9
|
handledBy?: string;
|
|
10
10
|
handledAt?: Date;
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
notes?: string;
|
|
12
|
+
logChannelId?: string;
|
|
13
|
+
logMessageId?: string;
|
|
14
|
+
meta?: Record<string, unknown>;
|
|
13
15
|
createdAt: Date;
|
|
14
16
|
updatedAt: Date;
|
|
15
17
|
};
|
|
@@ -4,6 +4,7 @@ export type TPredictionOption = {
|
|
|
4
4
|
bets: {
|
|
5
5
|
userId: string;
|
|
6
6
|
amount: number;
|
|
7
|
+
betId: string;
|
|
7
8
|
}[];
|
|
8
9
|
};
|
|
9
10
|
export type TPrediction = {
|
|
@@ -13,7 +14,7 @@ export type TPrediction = {
|
|
|
13
14
|
creatorId: string;
|
|
14
15
|
title: string;
|
|
15
16
|
choices: TPredictionOption[];
|
|
16
|
-
status: 'active' | 'ended' | 'paid' | 'canceled';
|
|
17
|
+
status: 'active' | 'ended' | 'paying' | 'paid' | 'canceled';
|
|
17
18
|
autolock?: Date | null;
|
|
18
19
|
createdAt: Date;
|
|
19
20
|
updatedAt: Date;
|
|
@@ -1,10 +1,14 @@
|
|
|
1
|
+
import type { CasinoGameId } from '../constants/casinoGames';
|
|
2
|
+
export type TransactionMeta = {
|
|
3
|
+
game?: CasinoGameId;
|
|
4
|
+
} & Record<string, unknown>;
|
|
1
5
|
export type TTransaction = {
|
|
2
6
|
userId: string;
|
|
3
7
|
guildId: string;
|
|
4
8
|
amount: number;
|
|
5
9
|
type: 'deposit' | 'withdraw' | 'bet' | 'win' | 'refund' | 'bonus' | 'vip';
|
|
6
10
|
source: 'command' | 'manual' | 'web' | 'system' | 'casino';
|
|
7
|
-
meta?:
|
|
11
|
+
meta?: TransactionMeta;
|
|
8
12
|
betId?: string;
|
|
9
13
|
handledBy?: string;
|
|
10
14
|
createdAt: Date;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export declare const canClaimDailyBonus: (lastClaim: Date | null, now: Date) => boolean;
|
|
2
2
|
export declare const getStreakAfterClaim: (lastClaim: Date | null, now: Date, currentStreak: number) => number;
|
|
3
|
+
export declare const getEffectiveStreak: (lastClaim: Date | null, now: Date, storedStreak: number) => number;
|
|
3
4
|
export declare const getStreakDisplay: (lastClaim: Date | null, now: Date, streak: number) => {
|
|
4
5
|
currentStreak: number;
|
|
5
6
|
nextStreak: number;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getStreakDisplay = exports.getStreakAfterClaim = exports.canClaimDailyBonus = void 0;
|
|
3
|
+
exports.getStreakDisplay = exports.getEffectiveStreak = exports.getStreakAfterClaim = exports.canClaimDailyBonus = void 0;
|
|
4
4
|
const DAY_MS = 24 * 60 * 60 * 1000;
|
|
5
5
|
const canClaimDailyBonus = (lastClaim, now) => {
|
|
6
6
|
if (!lastClaim)
|
|
@@ -17,6 +17,15 @@ const getStreakAfterClaim = (lastClaim, now, currentStreak) => {
|
|
|
17
17
|
return 1;
|
|
18
18
|
};
|
|
19
19
|
exports.getStreakAfterClaim = getStreakAfterClaim;
|
|
20
|
+
const getEffectiveStreak = (lastClaim, now, storedStreak) => {
|
|
21
|
+
if (!lastClaim)
|
|
22
|
+
return 0;
|
|
23
|
+
const diff = now.getTime() - lastClaim.getTime();
|
|
24
|
+
if (diff >= 2 * DAY_MS)
|
|
25
|
+
return 0;
|
|
26
|
+
return storedStreak;
|
|
27
|
+
};
|
|
28
|
+
exports.getEffectiveStreak = getEffectiveStreak;
|
|
20
29
|
const getStreakDisplay = (lastClaim, now, streak) => {
|
|
21
30
|
if (!lastClaim) {
|
|
22
31
|
return { currentStreak: 0, nextStreak: 1 };
|
|
@@ -10,4 +10,5 @@ export type CalculateBonusRewardResult = {
|
|
|
10
10
|
monthly: number;
|
|
11
11
|
isReset: boolean;
|
|
12
12
|
};
|
|
13
|
+
export declare const getBonusCycleLength: (rewardMode: BonusSettings["rewardMode"], baseReward: number, maxReward: number, streakIncrement: number, streakMultiplier: number) => number;
|
|
13
14
|
export declare const calculateBonusReward: ({ streak, settings }: CalculateBonusRewardInput) => CalculateBonusRewardResult;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.calculateBonusReward = void 0;
|
|
4
|
-
const
|
|
3
|
+
exports.calculateBonusReward = exports.getBonusCycleLength = void 0;
|
|
4
|
+
const getBonusCycleLength = (rewardMode, baseReward, maxReward, streakIncrement, streakMultiplier) => {
|
|
5
5
|
if (rewardMode === 'linear') {
|
|
6
6
|
return streakIncrement > 0
|
|
7
7
|
? Math.floor((maxReward - baseReward) / streakIncrement) + 1
|
|
@@ -11,6 +11,7 @@ const getCycleLength = (rewardMode, baseReward, maxReward, streakIncrement, stre
|
|
|
11
11
|
? Math.floor(Math.log(maxReward / baseReward) / Math.log(streakMultiplier)) + 1
|
|
12
12
|
: 1;
|
|
13
13
|
};
|
|
14
|
+
exports.getBonusCycleLength = getBonusCycleLength;
|
|
14
15
|
const calculateBonusReward = ({ streak, settings }) => {
|
|
15
16
|
const { rewardMode, baseReward, streakIncrement = 0, streakMultiplier = 1, maxReward, resetOnMax, milestoneBonus } = settings;
|
|
16
17
|
let base = rewardMode === 'linear'
|
|
@@ -18,7 +19,7 @@ const calculateBonusReward = ({ streak, settings }) => {
|
|
|
18
19
|
: baseReward * Math.pow(streakMultiplier, streak - 1);
|
|
19
20
|
let isReset = false;
|
|
20
21
|
if (maxReward > 0 && resetOnMax && base > maxReward) {
|
|
21
|
-
const cycle =
|
|
22
|
+
const cycle = (0, exports.getBonusCycleLength)(rewardMode, baseReward, maxReward, streakIncrement, streakMultiplier);
|
|
22
23
|
const cycleStreak = ((streak - 1) % cycle) + 1;
|
|
23
24
|
isReset = streak > cycle && cycleStreak === 1;
|
|
24
25
|
base =
|
|
@@ -97,9 +97,12 @@ const calculateRTP = (game, settings) => {
|
|
|
97
97
|
const { winMultiplier, oneInChance } = settings;
|
|
98
98
|
return (toNumber(winMultiplier) / toNumber(oneInChance)) * 100;
|
|
99
99
|
}
|
|
100
|
+
case 'raffle': {
|
|
101
|
+
const { casinoCut } = settings;
|
|
102
|
+
return (1 - toNumber(casinoCut)) * 100;
|
|
103
|
+
}
|
|
100
104
|
case 'blackjack':
|
|
101
105
|
case 'prediction':
|
|
102
|
-
case 'raffle':
|
|
103
106
|
return 0;
|
|
104
107
|
case 'plinko': {
|
|
105
108
|
const { binMultipliers } = settings;
|
|
@@ -114,7 +117,9 @@ const calculateRTP = (game, settings) => {
|
|
|
114
117
|
return rtp * 100;
|
|
115
118
|
}
|
|
116
119
|
default:
|
|
117
|
-
|
|
120
|
+
if (game !== 'winAnnouncements') {
|
|
121
|
+
console.warn(`RTP for ${game} not implemented`);
|
|
122
|
+
}
|
|
118
123
|
return 0;
|
|
119
124
|
}
|
|
120
125
|
};
|
|
@@ -11,3 +11,6 @@ export declare const getReadableName: (key: string, map: {
|
|
|
11
11
|
name: string;
|
|
12
12
|
value: string;
|
|
13
13
|
}[]) => string;
|
|
14
|
+
export declare const formatCasinoGameLabel: (gameId: string) => string;
|
|
15
|
+
export declare const formatTransactionSourceLabel: (source: string) => string;
|
|
16
|
+
export declare const formatTransactionTypeLabel: (type: string) => string;
|
package/dist/utils/formatters.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getReadableName = exports.formatNumberToPercentage = exports.formatMoneyExact = exports.formatMoney = exports.formatNumberWithSpaces = exports.parseReadableStringToNumber = exports.formatNumberToReadableString = void 0;
|
|
3
|
+
exports.formatTransactionTypeLabel = exports.formatTransactionSourceLabel = exports.formatCasinoGameLabel = exports.getReadableName = exports.formatNumberToPercentage = exports.formatMoneyExact = exports.formatMoney = exports.formatNumberWithSpaces = exports.parseReadableStringToNumber = exports.formatNumberToReadableString = void 0;
|
|
4
|
+
const defaultConfig_1 = require("../constants/defaultConfig");
|
|
4
5
|
const globalSettings_1 = require("./globalSettings");
|
|
5
6
|
const formatAmountWithCurrency = (amount, formattedAbsAmount, globalSettings) => {
|
|
6
7
|
const negative = amount < 0;
|
|
@@ -68,3 +69,9 @@ const getReadableName = (key, map) => {
|
|
|
68
69
|
return found ? found.name : key;
|
|
69
70
|
};
|
|
70
71
|
exports.getReadableName = getReadableName;
|
|
72
|
+
const formatCasinoGameLabel = (gameId) => (0, exports.getReadableName)(gameId, defaultConfig_1.readableGameNames).toUpperCase();
|
|
73
|
+
exports.formatCasinoGameLabel = formatCasinoGameLabel;
|
|
74
|
+
const formatTransactionSourceLabel = (source) => source.toUpperCase();
|
|
75
|
+
exports.formatTransactionSourceLabel = formatTransactionSourceLabel;
|
|
76
|
+
const formatTransactionTypeLabel = (type) => type.toUpperCase();
|
|
77
|
+
exports.formatTransactionTypeLabel = formatTransactionTypeLabel;
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -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';
|
package/dist/utils/index.js
CHANGED
|
@@ -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,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.
|
|
3
|
+
"version": "0.1.54",
|
|
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
|
-
"
|
|
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"
|
|
@@ -58,5 +60,5 @@
|
|
|
58
60
|
"luxon": "^3.7.2",
|
|
59
61
|
"zod": "^4.3.6"
|
|
60
62
|
},
|
|
61
|
-
"packageManager": "pnpm@
|
|
63
|
+
"packageManager": "pnpm@11.5.0"
|
|
62
64
|
}
|