Skip to content

Commit

Permalink
Add tier edit msg
Browse files Browse the repository at this point in the history
  • Loading branch information
gc committed Jul 15, 2024
1 parent 9bc67d4 commit 18fe8ec
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 2 deletions.
15 changes: 15 additions & 0 deletions dist/TSRedis.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,21 @@ declare const messageSchema: z.ZodUnion<[z.ZodObject<{
type: "ping";
}, {
type: "ping";
}>, z.ZodObject<{
type: z.ZodLiteral<"patron_tier_change">;
new_tier: z.ZodNumber;
old_tier: z.ZodNumber;
discord_id: z.ZodString;
}, "strip", z.ZodTypeAny, {
type: "patron_tier_change";
new_tier: number;
old_tier: number;
discord_id: string;
}, {
type: "patron_tier_change";
new_tier: number;
old_tier: number;
discord_id: string;
}>]>;
type Message = z.infer<typeof messageSchema>;
export declare class TSRedis {
Expand Down
8 changes: 7 additions & 1 deletion dist/TSRedis.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 8 additions & 1 deletion src/TSRedis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,18 @@ const newPatronMessageSchema = z.object({
tier: z.number().int()
});

const patronTierChangeMessageSchema = z.object({
type: z.literal('patron_tier_change'),
new_tier: z.number().int(),
old_tier: z.number().int(),
discord_id: z.string()
});

const pingMessageSchema = z.object({
type: z.literal('ping')
});

const messageSchema = z.union([newPatronMessageSchema, pingMessageSchema]);
const messageSchema = z.union([newPatronMessageSchema, pingMessageSchema, patronTierChangeMessageSchema]);

type Message = z.infer<typeof messageSchema>;

Expand Down

0 comments on commit 18fe8ec

Please sign in to comment.