mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-04 20:20:21 +00:00
refactor: use shared pairing store for telegram
This commit is contained in:
@@ -29,6 +29,7 @@ import { formatCliCommand } from "../cli/command-format.js";
|
||||
import { readSessionUpdatedAt, resolveStorePath } from "../config/sessions.js";
|
||||
import { logVerbose, shouldLogVerbose } from "../globals.js";
|
||||
import { recordChannelActivity } from "../infra/channel-activity.js";
|
||||
import { upsertChannelPairingRequest } from "../pairing/pairing-store.js";
|
||||
import { resolveAgentRoute } from "../routing/resolve-route.js";
|
||||
import { resolveThreadSessionKeys } from "../routing/session-key.js";
|
||||
import { withTelegramApiErrorLogging } from "./api-logging.js";
|
||||
@@ -52,7 +53,6 @@ import {
|
||||
hasBotMention,
|
||||
resolveTelegramForumThreadId,
|
||||
} from "./bot/helpers.js";
|
||||
import { upsertTelegramPairingRequest } from "./pairing-store.js";
|
||||
|
||||
type TelegramMediaRef = {
|
||||
path: string;
|
||||
@@ -252,11 +252,14 @@ export const buildTelegramMessageContext = async ({
|
||||
}
|
||||
| undefined;
|
||||
const telegramUserId = from?.id ? String(from.id) : candidate;
|
||||
const { code, created } = await upsertTelegramPairingRequest({
|
||||
chatId: candidate,
|
||||
username: from?.username,
|
||||
firstName: from?.first_name,
|
||||
lastName: from?.last_name,
|
||||
const { code, created } = await upsertChannelPairingRequest({
|
||||
channel: "telegram",
|
||||
id: String(candidate),
|
||||
meta: {
|
||||
username: from?.username,
|
||||
firstName: from?.first_name,
|
||||
lastName: from?.last_name,
|
||||
},
|
||||
});
|
||||
if (created) {
|
||||
logger.info(
|
||||
|
||||
Reference in New Issue
Block a user