feat(telegram): show user id in pairing
This commit is contained in:
@@ -284,6 +284,9 @@ describe("createTelegramBot", () => {
|
||||
expect(replySpy).not.toHaveBeenCalled();
|
||||
expect(sendMessageSpy).toHaveBeenCalledTimes(1);
|
||||
expect(sendMessageSpy.mock.calls[0]?.[0]).toBe(1234);
|
||||
expect(String(sendMessageSpy.mock.calls[0]?.[1])).toContain(
|
||||
"Your Telegram user id: 999",
|
||||
);
|
||||
expect(String(sendMessageSpy.mock.calls[0]?.[1])).toContain(
|
||||
"Pairing code:",
|
||||
);
|
||||
|
||||
@@ -390,8 +390,10 @@ export function createTelegramBot(opts: TelegramBotOptions) {
|
||||
first_name?: string;
|
||||
last_name?: string;
|
||||
username?: string;
|
||||
id?: number;
|
||||
}
|
||||
| undefined;
|
||||
const telegramUserId = from?.id ? String(from.id) : candidate;
|
||||
const { code, created } = await upsertTelegramPairingRequest({
|
||||
chatId: candidate,
|
||||
username: from?.username,
|
||||
@@ -413,6 +415,8 @@ export function createTelegramBot(opts: TelegramBotOptions) {
|
||||
[
|
||||
"Clawdbot: access not configured.",
|
||||
"",
|
||||
`Your Telegram user id: ${telegramUserId}`,
|
||||
"",
|
||||
`Pairing code: ${code}`,
|
||||
"",
|
||||
"Ask the bot owner to approve with:",
|
||||
|
||||
Reference in New Issue
Block a user