feat(bot): add guided private prompts

This commit is contained in:
2026-03-09 05:15:29 +04:00
parent fac2dc0e9d
commit 4e200b506a
11 changed files with 785 additions and 66 deletions

View File

@@ -0,0 +1,13 @@
CREATE TABLE "telegram_pending_actions" (
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
"telegram_user_id" text NOT NULL,
"telegram_chat_id" text NOT NULL,
"action" text NOT NULL,
"payload" jsonb DEFAULT '{}'::jsonb NOT NULL,
"expires_at" timestamp with time zone,
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
"updated_at" timestamp with time zone DEFAULT now() NOT NULL
);
--> statement-breakpoint
CREATE UNIQUE INDEX "telegram_pending_actions_chat_user_unique" ON "telegram_pending_actions" USING btree ("telegram_chat_id","telegram_user_id");--> statement-breakpoint
CREATE INDEX "telegram_pending_actions_user_action_idx" ON "telegram_pending_actions" USING btree ("telegram_user_id","action");

View File

@@ -50,6 +50,13 @@
"when": 1773015092441,
"tag": "0006_marvelous_nehzno",
"breakpoints": true
},
{
"idx": 7,
"version": "7",
"when": 1773051000000,
"tag": "0007_sudden_murmur",
"breakpoints": true
}
]
}

View File

@@ -107,6 +107,32 @@ export const householdPendingMembers = pgTable(
})
)
export const telegramPendingActions = pgTable(
'telegram_pending_actions',
{
id: uuid('id').defaultRandom().primaryKey(),
telegramUserId: text('telegram_user_id').notNull(),
telegramChatId: text('telegram_chat_id').notNull(),
action: text('action').notNull(),
payload: jsonb('payload')
.default(sql`'{}'::jsonb`)
.notNull(),
expiresAt: timestamp('expires_at', { withTimezone: true }),
createdAt: timestamp('created_at', { withTimezone: true }).defaultNow().notNull(),
updatedAt: timestamp('updated_at', { withTimezone: true }).defaultNow().notNull()
},
(table) => ({
chatUserUnique: uniqueIndex('telegram_pending_actions_chat_user_unique').on(
table.telegramChatId,
table.telegramUserId
),
userActionIdx: index('telegram_pending_actions_user_action_idx').on(
table.telegramUserId,
table.action
)
})
)
export const members = pgTable(
'members',
{