mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-10 18:44:57 +00:00
chore: Fix types in tests 2/N.
This commit is contained in:
@@ -33,6 +33,9 @@ import { recordSentMessage } from "./sent-message-cache.js";
|
||||
import { parseTelegramTarget, stripTelegramInternalPrefixes } from "./targets.js";
|
||||
import { resolveTelegramVoiceSend } from "./voice.js";
|
||||
|
||||
type TelegramApi = Bot["api"];
|
||||
type TelegramApiOverride = Partial<TelegramApi>;
|
||||
|
||||
type TelegramSendOpts = {
|
||||
token?: string;
|
||||
accountId?: string;
|
||||
@@ -40,7 +43,7 @@ type TelegramSendOpts = {
|
||||
mediaUrl?: string;
|
||||
mediaLocalRoots?: readonly string[];
|
||||
maxBytes?: number;
|
||||
api?: Bot["api"];
|
||||
api?: TelegramApiOverride;
|
||||
retry?: RetryConfig;
|
||||
textMode?: "markdown" | "html";
|
||||
plainText?: string;
|
||||
@@ -73,7 +76,7 @@ type TelegramMessageLike = {
|
||||
type TelegramReactionOpts = {
|
||||
token?: string;
|
||||
accountId?: string;
|
||||
api?: Bot["api"];
|
||||
api?: TelegramApiOverride;
|
||||
remove?: boolean;
|
||||
verbose?: boolean;
|
||||
retry?: RetryConfig;
|
||||
@@ -289,13 +292,13 @@ async function withTelegramHtmlParseFallback<T>(params: {
|
||||
type TelegramApiContext = {
|
||||
cfg: ReturnType<typeof loadConfig>;
|
||||
account: ResolvedTelegramAccount;
|
||||
api: Bot["api"];
|
||||
api: TelegramApi;
|
||||
};
|
||||
|
||||
function resolveTelegramApiContext(opts: {
|
||||
token?: string;
|
||||
accountId?: string;
|
||||
api?: Bot["api"];
|
||||
api?: TelegramApiOverride;
|
||||
cfg?: ReturnType<typeof loadConfig>;
|
||||
}): TelegramApiContext {
|
||||
const cfg = opts.cfg ?? loadConfig();
|
||||
@@ -305,7 +308,7 @@ function resolveTelegramApiContext(opts: {
|
||||
});
|
||||
const token = resolveToken(opts.token, account);
|
||||
const client = resolveTelegramClientOptions(account);
|
||||
const api = opts.api ?? new Bot(token, client ? { client } : undefined).api;
|
||||
const api = (opts.api ?? new Bot(token, client ? { client } : undefined).api) as TelegramApi;
|
||||
return { cfg, account, api };
|
||||
}
|
||||
|
||||
@@ -759,7 +762,7 @@ type TelegramDeleteOpts = {
|
||||
token?: string;
|
||||
accountId?: string;
|
||||
verbose?: boolean;
|
||||
api?: Bot["api"];
|
||||
api?: TelegramApiOverride;
|
||||
retry?: RetryConfig;
|
||||
};
|
||||
|
||||
@@ -787,7 +790,7 @@ type TelegramEditOpts = {
|
||||
token?: string;
|
||||
accountId?: string;
|
||||
verbose?: boolean;
|
||||
api?: Bot["api"];
|
||||
api?: TelegramApiOverride;
|
||||
retry?: RetryConfig;
|
||||
textMode?: "markdown" | "html";
|
||||
/** Controls whether link previews are shown in the edited message. */
|
||||
@@ -904,7 +907,7 @@ type TelegramStickerOpts = {
|
||||
token?: string;
|
||||
accountId?: string;
|
||||
verbose?: boolean;
|
||||
api?: Bot["api"];
|
||||
api?: TelegramApiOverride;
|
||||
retry?: RetryConfig;
|
||||
/** Message ID to reply to (for threading) */
|
||||
replyToMessageId?: number;
|
||||
@@ -980,7 +983,7 @@ type TelegramPollOpts = {
|
||||
token?: string;
|
||||
accountId?: string;
|
||||
verbose?: boolean;
|
||||
api?: Bot["api"];
|
||||
api?: TelegramApiOverride;
|
||||
retry?: RetryConfig;
|
||||
/** Message ID to reply to (for threading) */
|
||||
replyToMessageId?: number;
|
||||
|
||||
Reference in New Issue
Block a user