feat: sync bot setup and webhook diagnostics
This commit is contained in:
parent
f53579416e
commit
d9875b5caa
11 changed files with 521 additions and 29 deletions
13
deploy/migrations/0130_botfather_done_command.down.sql
Normal file
13
deploy/migrations/0130_botfather_done_command.down.sql
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
UPDATE public.bots
|
||||
SET commands = COALESCE((
|
||||
SELECT jsonb_agg(command ORDER BY ordinal)
|
||||
FROM jsonb_array_elements(commands) WITH ORDINALITY AS item(command, ordinal)
|
||||
WHERE command->>'command' <> 'done'
|
||||
), '[]'::jsonb),
|
||||
updated_at = now()
|
||||
WHERE bot_user_id = 93372553;
|
||||
|
||||
UPDATE public.users
|
||||
SET bot_info_version = bot_info_version + 1,
|
||||
updated_at = now()
|
||||
WHERE id = 93372553;
|
||||
22
deploy/migrations/0130_botfather_done_command.up.sql
Normal file
22
deploy/migrations/0130_botfather_done_command.up.sql
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
-- /setlogin remains active across multiple configuration messages. Publish
|
||||
-- /done in BotFather's command menu so clients can discover the explicit
|
||||
-- finish action without reopening /help.
|
||||
UPDATE public.bots
|
||||
SET commands = commands || '[
|
||||
{"command":"done","description":"finish Telegram Login configuration"}
|
||||
]'::jsonb,
|
||||
updated_at = now()
|
||||
WHERE bot_user_id = 93372553
|
||||
AND NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM jsonb_array_elements(commands) AS item(command)
|
||||
WHERE item.command->>'command' = 'done'
|
||||
);
|
||||
|
||||
-- Bot command menus are cached by bot_info_version. Bump it even when an
|
||||
-- operator already added /done manually, making the migration convergent and
|
||||
-- forcing connected clients to refresh the authoritative command list.
|
||||
UPDATE public.users
|
||||
SET bot_info_version = bot_info_version + 1,
|
||||
updated_at = now()
|
||||
WHERE id = 93372553;
|
||||
Loading…
Add table
Add a link
Reference in a new issue