AS AgentScopeAPI 手册 / API Reference

GitHubBotIdentityResolver

public final class GitHubBotIdentityResolver
源码Source io/agentscope/extensions/channel/github/GitHubBotIdentityResolver.java:37–100

GitHub Bot 身份解析器,把智能体接入外部消息渠道与企业平台。位于 io.agentscope.extensions.channel.github 包。核心成员包括 refresh、botUserId、botLogin、GitHubBotIdentityResolver。

Resolves the bot's GitHub user id (and login) for the configured PAT by calling GET /user. Used for bot-loop self-detection in the webhook handler — when a webhook delivers a comment authored by the bot itself, the channel must drop it instead of looping forever.

The lookup is best-effort: a network failure does not block startup. The resolved id is cached for the lifetime of the channel and accessed via #botUserId().

构造器摘要Constructor Summary

构造器Constructor说明Description
public GitHubBotIdentityResolver(String apiBase, String token, String botLoginOverride)
初始化 `GitHubBotIdentityResolver` 实例。
Creates a new instance.

方法摘要Method Summary

方法Method说明Description
public void refresh()
执行刷新相关操作。
Synchronously attempts to resolve `GET /user` and cache the response.
public long botUserId()
返回 `botUserId` 结果。
Returns the bot's numeric user id, or `-1` if unresolved.
public String botLogin()
返回 `botLogin` 结果。
Returns the bot's login (handle), or null if unresolved.

构造器详情Constructor Detail

GitHubBotIdentityResolver

public GitHubBotIdentityResolver(String apiBase, String token, String botLoginOverride)

初始化 GitHubBotIdentityResolver 实例。

Creates a new instance.

参数Parameters
名称Name类型Type说明Description
apiBaseStringAPI 基类(类型 `String`)。The api base.
tokenString令牌(类型 `String`)。The token.
botLoginOverrideStringbot Login Override(类型 `String`)。The bot login override.
源码Source io/agentscope/extensions/channel/github/GitHubBotIdentityResolver.java:46–52

方法详情Method Detail

refresh

public void refresh()

执行刷新相关操作。

Synchronously attempts to resolve GET /user and cache the response.

源码Source io/agentscope/extensions/channel/github/GitHubBotIdentityResolver.java:58–85

botUserId

public long botUserId()

返回 botUserId 结果。

Returns the bot's numeric user id, or -1 if unresolved.

返回Returns long
返回数值结果。Returns a numeric result.
源码Source io/agentscope/extensions/channel/github/GitHubBotIdentityResolver.java:88–90

botLogin

public String botLogin()

返回 botLogin 结果。

Returns the bot's login (handle), or null if unresolved.

返回Returns String
返回字符串结果。Returns a string.
源码Source io/agentscope/extensions/channel/github/GitHubBotIdentityResolver.java:93–95
基于官方固定版本源码静态生成Generated from pinned official sources · Python 2.0.11 · Java 2.0.4
签名与文档为静态抽取;如有疑问请以源码为准。Signatures and docs are extracted statically; verify against the source when in doubt.