gambling-bot-shared 1.0.8 → 1.0.9
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/dist/blackjack/index.d.ts +1 -0
- package/dist/blackjack/index.js +1 -0
- package/dist/casino/blackjackGame.mongoose.d.ts +9 -0
- package/dist/casino/blackjackGame.mongoose.js +2 -1
- package/dist/casino/constants/blackjackWorkers.d.ts +5 -0
- package/dist/casino/constants/blackjackWorkers.js +17 -0
- package/dist/casino/constants/index.d.ts +1 -0
- package/dist/casino/constants/index.js +1 -0
- package/dist/casino/types/blackjackGame.d.ts +1 -0
- package/dist/common/durations.d.ts +5 -0
- package/dist/common/durations.js +8 -0
- package/dist/common/index.d.ts +1 -0
- package/dist/common/index.js +1 -0
- package/dist/guild/guildConfiguration.mongoose.d.ts +9 -0
- package/dist/guild/guildConfiguration.mongoose.js +4 -0
- package/dist/guild/index.d.ts +1 -0
- package/dist/guild/index.js +1 -0
- package/dist/guild/schemas/guild.forms.d.ts +1 -0
- package/dist/guild/schemas/guild.forms.js +2 -1
- package/dist/guild/types/guildConfiguration.d.ts +1 -0
- package/dist/guild/utils/workerLogChannel.d.ts +2 -0
- package/dist/guild/utils/workerLogChannel.js +6 -0
- package/dist/predictions/services/prediction.db.d.ts +1 -8
- package/dist/predictions/services/prediction.db.js +0 -8
- package/dist/predictions/services/types.d.ts +0 -4
- package/dist/vip/types/vipRoom.d.ts +2 -0
- package/dist/vip/vipRoom.mongoose.d.ts +9 -0
- package/dist/vip/vipRoom.mongoose.js +5 -0
- package/package.json +1 -1
package/dist/blackjack/index.js
CHANGED
|
@@ -15,4 +15,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("../casino/constants/blackjack"), exports);
|
|
18
|
+
__exportStar(require("../casino/constants/blackjackWorkers"), exports);
|
|
18
19
|
__exportStar(require("../casino/types/blackjackGame"), exports);
|
|
@@ -108,6 +108,15 @@ export declare const BlackjackGameSchema: Schema<TBlackjackGame, import("mongoos
|
|
|
108
108
|
}, "id"> & {
|
|
109
109
|
id: string;
|
|
110
110
|
}> | undefined;
|
|
111
|
+
idleNudgeSentAt?: import("mongoose").SchemaDefinitionProperty<Date | null | undefined, TBlackjackGame, import("mongoose").Document<unknown, {}, TBlackjackGame, {
|
|
112
|
+
id: string;
|
|
113
|
+
}, import("mongoose").DefaultSchemaOptions> & Omit<TBlackjackGame & {
|
|
114
|
+
_id: import("mongoose").Types.ObjectId;
|
|
115
|
+
} & {
|
|
116
|
+
__v: number;
|
|
117
|
+
}, "id"> & {
|
|
118
|
+
id: string;
|
|
119
|
+
}> | undefined;
|
|
111
120
|
createdAt?: import("mongoose").SchemaDefinitionProperty<Date, TBlackjackGame, import("mongoose").Document<unknown, {}, TBlackjackGame, {
|
|
112
121
|
id: string;
|
|
113
122
|
}, import("mongoose").DefaultSchemaOptions> & Omit<TBlackjackGame & {
|
|
@@ -29,6 +29,7 @@ exports.BlackjackGameSchema = new mongoose_1.Schema({
|
|
|
29
29
|
default: 'PLAYER'
|
|
30
30
|
},
|
|
31
31
|
activeHandIndex: { type: Number, required: true, default: 0 },
|
|
32
|
-
dealerCards: [cardSchema]
|
|
32
|
+
dealerCards: [cardSchema],
|
|
33
|
+
idleNudgeSentAt: { type: Date, default: null }
|
|
33
34
|
}, { timestamps: true });
|
|
34
35
|
exports.BlackjackGameSchema.index({ userId: 1, guildId: 1 }, { unique: true });
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const BLACKJACK_AUTOSTAND_IDLE_DAYS = 1;
|
|
2
|
+
export declare const BLACKJACK_IDLE_NUDGE_HOURS = 3;
|
|
3
|
+
export declare const blackjackIdleNudgeThresholdMs: () => number;
|
|
4
|
+
export declare const blackjackAutostandIdleMs: () => number;
|
|
5
|
+
export declare const hoursUntilBlackjackAutostand: (updatedAt: Date, nowMs?: number) => number;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.hoursUntilBlackjackAutostand = exports.blackjackAutostandIdleMs = exports.blackjackIdleNudgeThresholdMs = exports.BLACKJACK_IDLE_NUDGE_HOURS = exports.BLACKJACK_AUTOSTAND_IDLE_DAYS = void 0;
|
|
4
|
+
exports.BLACKJACK_AUTOSTAND_IDLE_DAYS = 1;
|
|
5
|
+
exports.BLACKJACK_IDLE_NUDGE_HOURS = 3;
|
|
6
|
+
const MS_PER_HOUR = 60 * 60 * 1000;
|
|
7
|
+
const MS_PER_DAY = 24 * MS_PER_HOUR;
|
|
8
|
+
const blackjackIdleNudgeThresholdMs = () => exports.BLACKJACK_IDLE_NUDGE_HOURS * MS_PER_HOUR;
|
|
9
|
+
exports.blackjackIdleNudgeThresholdMs = blackjackIdleNudgeThresholdMs;
|
|
10
|
+
const blackjackAutostandIdleMs = () => exports.BLACKJACK_AUTOSTAND_IDLE_DAYS * MS_PER_DAY;
|
|
11
|
+
exports.blackjackAutostandIdleMs = blackjackAutostandIdleMs;
|
|
12
|
+
const hoursUntilBlackjackAutostand = (updatedAt, nowMs = Date.now()) => {
|
|
13
|
+
const autostandAt = updatedAt.getTime() + (0, exports.blackjackAutostandIdleMs)();
|
|
14
|
+
const hoursLeft = (autostandAt - nowMs) / MS_PER_HOUR;
|
|
15
|
+
return Math.max(1, Math.ceil(hoursLeft));
|
|
16
|
+
};
|
|
17
|
+
exports.hoursUntilBlackjackAutostand = hoursUntilBlackjackAutostand;
|
|
@@ -15,6 +15,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./blackjack"), exports);
|
|
18
|
+
__exportStar(require("./blackjackWorkers"), exports);
|
|
18
19
|
__exportStar(require("./casinoGames"), exports);
|
|
19
20
|
__exportStar(require("./defaultConfig"), exports);
|
|
20
21
|
__exportStar(require("./lotteryConfig"), exports);
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.WEEK_MS = exports.DAY_MS = exports.HOUR_MS = exports.MINUTE_MS = exports.SECOND_MS = void 0;
|
|
4
|
+
exports.SECOND_MS = 1000;
|
|
5
|
+
exports.MINUTE_MS = 60 * exports.SECOND_MS;
|
|
6
|
+
exports.HOUR_MS = 60 * exports.MINUTE_MS;
|
|
7
|
+
exports.DAY_MS = 24 * exports.HOUR_MS;
|
|
8
|
+
exports.WEEK_MS = 7 * exports.DAY_MS;
|
package/dist/common/index.d.ts
CHANGED
package/dist/common/index.js
CHANGED
|
@@ -14,6 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./durations"), exports);
|
|
17
18
|
__exportStar(require("./formatters"), exports);
|
|
18
19
|
__exportStar(require("./generateId"), exports);
|
|
19
20
|
__exportStar(require("./parseTimeToSeconds"), exports);
|
|
@@ -72,6 +72,15 @@ export declare const GuildConfigurationSchema: Schema<TGuildConfiguration, impor
|
|
|
72
72
|
}, "id"> & {
|
|
73
73
|
id: string;
|
|
74
74
|
}> | undefined;
|
|
75
|
+
workerLogChannelId?: import("mongoose").SchemaDefinitionProperty<string, TGuildConfiguration, import("mongoose").Document<unknown, {}, TGuildConfiguration, {
|
|
76
|
+
id: string;
|
|
77
|
+
}, import("mongoose").DefaultSchemaOptions> & Omit<TGuildConfiguration & {
|
|
78
|
+
_id: import("mongoose").Types.ObjectId;
|
|
79
|
+
} & {
|
|
80
|
+
__v: number;
|
|
81
|
+
}, "id"> & {
|
|
82
|
+
id: string;
|
|
83
|
+
}> | undefined;
|
|
75
84
|
managerRoleId?: import("mongoose").SchemaDefinitionProperty<string, TGuildConfiguration, import("mongoose").Document<unknown, {}, TGuildConfiguration, {
|
|
76
85
|
id: string;
|
|
77
86
|
}, import("mongoose").DefaultSchemaOptions> & Omit<TGuildConfiguration & {
|
package/dist/guild/index.d.ts
CHANGED
package/dist/guild/index.js
CHANGED
|
@@ -20,4 +20,5 @@ __exportStar(require("./types/guildConfiguration"), exports);
|
|
|
20
20
|
__exportStar(require("./utils/globalSettings"), exports);
|
|
21
21
|
__exportStar(require("./utils/normalizeGlobalSettings"), exports);
|
|
22
22
|
__exportStar(require("./utils/guildTimezone"), exports);
|
|
23
|
+
__exportStar(require("./utils/workerLogChannel"), exports);
|
|
23
24
|
__exportStar(require("./schemas/guild.forms"), exports);
|
|
@@ -16,6 +16,7 @@ export declare const channelsFormSchema: z.ZodObject<{
|
|
|
16
16
|
actions: z.ZodString;
|
|
17
17
|
logs: z.ZodString;
|
|
18
18
|
}, z.core.$strip>;
|
|
19
|
+
workerLogChannelId: z.ZodString;
|
|
19
20
|
}, z.core.$strip>;
|
|
20
21
|
export declare const managerRoleFormSchema: z.ZodObject<{
|
|
21
22
|
managerRoleId: z.ZodString;
|
|
@@ -14,7 +14,8 @@ exports.channelsFormSchema = zod_1.default.object({
|
|
|
14
14
|
atm: atm_forms_1.atmChannelsFormSchema,
|
|
15
15
|
casino: casino_forms_1.casinoChannelsFormSchema,
|
|
16
16
|
prediction: prediction_forms_1.predictionChannelsFormSchema,
|
|
17
|
-
raffle: raffle_forms_1.raffleChannelsFormSchema
|
|
17
|
+
raffle: raffle_forms_1.raffleChannelsFormSchema,
|
|
18
|
+
workerLogChannelId: zod_1.default.string()
|
|
18
19
|
});
|
|
19
20
|
exports.managerRoleFormSchema = zod_1.default.object({
|
|
20
21
|
managerRoleId: zod_1.default.string(),
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Model } from 'mongoose';
|
|
2
2
|
import type { TPrediction } from '../types/prediction';
|
|
3
|
-
import type { TAddPredictionBet, TCreatePrediction,
|
|
3
|
+
import type { TAddPredictionBet, TCreatePrediction, TGetPrediction, TUpdatePredictionStatus } from './types';
|
|
4
4
|
export declare function createPredictionDb(predictionModel: Model<TPrediction>): {
|
|
5
5
|
getPredictionById: ({ predictionId, guildId }: TGetPrediction) => Promise<(import("mongoose").Document<unknown, {}, TPrediction, {}, import("mongoose").DefaultSchemaOptions> & TPrediction & {
|
|
6
6
|
_id: import("mongoose").Types.ObjectId;
|
|
@@ -19,13 +19,6 @@ export declare function createPredictionDb(predictionModel: Model<TPrediction>):
|
|
|
19
19
|
} & {
|
|
20
20
|
id: string;
|
|
21
21
|
})[]>;
|
|
22
|
-
getOldPredictions: ({ statuses, olderThanDays }: TGetOldPredictions) => Promise<(import("mongoose").Document<unknown, {}, TPrediction, {}, import("mongoose").DefaultSchemaOptions> & TPrediction & {
|
|
23
|
-
_id: import("mongoose").Types.ObjectId;
|
|
24
|
-
} & {
|
|
25
|
-
__v: number;
|
|
26
|
-
} & {
|
|
27
|
-
id: string;
|
|
28
|
-
})[]>;
|
|
29
22
|
createPrediction: ({ predictionId, guildId, channelId, creatorId, title, choices, autolock, status }: TCreatePrediction) => Promise<void>;
|
|
30
23
|
updatePredictionStatus: ({ predictionId, guildId, fromStatus, toStatus }: TUpdatePredictionStatus) => Promise<(import("mongoose").Document<unknown, {}, TPrediction, {}, import("mongoose").DefaultSchemaOptions> & TPrediction & {
|
|
31
24
|
_id: import("mongoose").Types.ObjectId;
|
|
@@ -12,13 +12,6 @@ function createPredictionDb(predictionModel) {
|
|
|
12
12
|
...(useAutolock ? { autolock: { $lte: now } } : {})
|
|
13
13
|
});
|
|
14
14
|
};
|
|
15
|
-
const getOldPredictions = async ({ statuses, olderThanDays }) => {
|
|
16
|
-
const cutoffDate = new Date(Date.now() - olderThanDays * 24 * 60 * 60 * 1000);
|
|
17
|
-
return predictionModel.find({
|
|
18
|
-
status: { $in: statuses },
|
|
19
|
-
updatedAt: { $lte: cutoffDate }
|
|
20
|
-
});
|
|
21
|
-
};
|
|
22
15
|
const createPrediction = async ({ predictionId, guildId, channelId, creatorId, title, choices, autolock, status }) => {
|
|
23
16
|
await predictionModel.create({
|
|
24
17
|
predictionId,
|
|
@@ -62,7 +55,6 @@ function createPredictionDb(predictionModel) {
|
|
|
62
55
|
return {
|
|
63
56
|
getPredictionById,
|
|
64
57
|
getPredictionToLock,
|
|
65
|
-
getOldPredictions,
|
|
66
58
|
createPrediction,
|
|
67
59
|
updatePredictionStatus,
|
|
68
60
|
deletePrediction,
|
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
import type { TPrediction, TPredictionOption } from '../types/prediction';
|
|
2
2
|
export type TCreatePrediction = Omit<TPrediction, 'createdAt' | 'updatedAt'>;
|
|
3
3
|
export type TGetPrediction = Pick<TPrediction, 'predictionId' | 'guildId'>;
|
|
4
|
-
export type TGetOldPredictions = {
|
|
5
|
-
statuses: TPrediction['status'][];
|
|
6
|
-
olderThanDays: number;
|
|
7
|
-
};
|
|
8
4
|
export type TUpdatePredictionStatus = Pick<TPrediction, 'predictionId' | 'guildId'> & {
|
|
9
5
|
fromStatus: TPrediction['status'] | TPrediction['status'][];
|
|
10
6
|
toStatus: TPrediction['status'];
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
export type VipExpiryWarningTier = '24h' | '1h';
|
|
1
2
|
export type TVipRoom = {
|
|
2
3
|
ownerId: string;
|
|
3
4
|
guildId: string;
|
|
4
5
|
channelId: string;
|
|
5
6
|
expiresAt: Date;
|
|
7
|
+
expiryWarningsSent?: VipExpiryWarningTier[];
|
|
6
8
|
memberIds: string[];
|
|
7
9
|
createdAt: Date;
|
|
8
10
|
updatedAt: Date;
|
|
@@ -45,6 +45,15 @@ export declare const VipRoomSchema: Schema<TVipRoom, import("mongoose").Model<TV
|
|
|
45
45
|
}, "id"> & {
|
|
46
46
|
id: string;
|
|
47
47
|
}> | undefined;
|
|
48
|
+
expiryWarningsSent?: import("mongoose").SchemaDefinitionProperty<import("./types/vipRoom").VipExpiryWarningTier[] | undefined, TVipRoom, import("mongoose").Document<unknown, {}, TVipRoom, {
|
|
49
|
+
id: string;
|
|
50
|
+
}, import("mongoose").DefaultSchemaOptions> & Omit<TVipRoom & {
|
|
51
|
+
_id: import("mongoose").Types.ObjectId;
|
|
52
|
+
} & {
|
|
53
|
+
__v: number;
|
|
54
|
+
}, "id"> & {
|
|
55
|
+
id: string;
|
|
56
|
+
}> | undefined;
|
|
48
57
|
memberIds?: import("mongoose").SchemaDefinitionProperty<string[], TVipRoom, import("mongoose").Document<unknown, {}, TVipRoom, {
|
|
49
58
|
id: string;
|
|
50
59
|
}, import("mongoose").DefaultSchemaOptions> & Omit<TVipRoom & {
|
|
@@ -10,6 +10,11 @@ exports.VipRoomSchema = new mongoose_1.Schema({
|
|
|
10
10
|
type: [String],
|
|
11
11
|
default: []
|
|
12
12
|
},
|
|
13
|
+
expiryWarningsSent: {
|
|
14
|
+
type: [String],
|
|
15
|
+
enum: ['24h', '1h'],
|
|
16
|
+
default: []
|
|
17
|
+
},
|
|
13
18
|
expiresAt: { type: Date, required: true }
|
|
14
19
|
}, { timestamps: true });
|
|
15
20
|
exports.VipRoomSchema.index({ expiresAt: 1 });
|