mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 12:41:23 +00:00
Telegram: use Grammy types directly, add typed Probe/Audit to plugin interface (#8403)
* Telegram: replace duplicated types with Grammy imports, add Probe/Audit generics to plugin interface * Telegram: remove legacy forward metadata (deprecated in Bot API 7.0), simplify required-field checks * Telegram: clean up remaining legacy references and unnecessary casts * Telegram: keep RequestInit parameter type in proxy fetch (addresses review feedback) * Telegram: add exhaustiveness guard to resolveForwardOrigin switch
This commit is contained in:
@@ -105,7 +105,7 @@ export type ChannelOutboundAdapter = {
|
||||
sendPoll?: (ctx: ChannelPollContext) => Promise<ChannelPollResult>;
|
||||
};
|
||||
|
||||
export type ChannelStatusAdapter<ResolvedAccount> = {
|
||||
export type ChannelStatusAdapter<ResolvedAccount, Probe = unknown, Audit = unknown> = {
|
||||
defaultRuntime?: ChannelAccountSnapshot;
|
||||
buildChannelSummary?: (params: {
|
||||
account: ResolvedAccount;
|
||||
@@ -117,19 +117,19 @@ export type ChannelStatusAdapter<ResolvedAccount> = {
|
||||
account: ResolvedAccount;
|
||||
timeoutMs: number;
|
||||
cfg: OpenClawConfig;
|
||||
}) => Promise<unknown>;
|
||||
}) => Promise<Probe>;
|
||||
auditAccount?: (params: {
|
||||
account: ResolvedAccount;
|
||||
timeoutMs: number;
|
||||
cfg: OpenClawConfig;
|
||||
probe?: unknown;
|
||||
}) => Promise<unknown>;
|
||||
probe?: Probe;
|
||||
}) => Promise<Audit>;
|
||||
buildAccountSnapshot?: (params: {
|
||||
account: ResolvedAccount;
|
||||
cfg: OpenClawConfig;
|
||||
runtime?: ChannelAccountSnapshot;
|
||||
probe?: unknown;
|
||||
audit?: unknown;
|
||||
probe?: Probe;
|
||||
audit?: Audit;
|
||||
}) => ChannelAccountSnapshot | Promise<ChannelAccountSnapshot>;
|
||||
logSelfId?: (params: {
|
||||
account: ResolvedAccount;
|
||||
|
||||
@@ -45,7 +45,7 @@ export type ChannelConfigSchema = {
|
||||
};
|
||||
|
||||
// oxlint-disable-next-line typescript/no-explicit-any
|
||||
export type ChannelPlugin<ResolvedAccount = any> = {
|
||||
export type ChannelPlugin<ResolvedAccount = any, Probe = unknown, Audit = unknown> = {
|
||||
id: ChannelId;
|
||||
meta: ChannelMeta;
|
||||
capabilities: ChannelCapabilities;
|
||||
@@ -65,7 +65,7 @@ export type ChannelPlugin<ResolvedAccount = any> = {
|
||||
groups?: ChannelGroupAdapter;
|
||||
mentions?: ChannelMentionAdapter;
|
||||
outbound?: ChannelOutboundAdapter;
|
||||
status?: ChannelStatusAdapter<ResolvedAccount>;
|
||||
status?: ChannelStatusAdapter<ResolvedAccount, Probe, Audit>;
|
||||
gatewayMethods?: string[];
|
||||
gateway?: ChannelGatewayAdapter<ResolvedAccount>;
|
||||
auth?: ChannelAuthAdapter;
|
||||
|
||||
Reference in New Issue
Block a user