我可以区分 Slack 显示名称和 Slack ID 吗?

Can I differentiate a Slack display name from a Slack ID?

我正在将我的软件与 Slack API 集成,我希望允许用户通过编写 "display name" 或 "user ID" 来配置 Slack 设置。

我想使用启发式方法来区分用户名和用户 ID。我在 Slack documentation 中阅读了以下内容:

id - this user's ID, which might start with U or W; IDs beginning with U are unique only to a workspace. IDs beginning with W are unique for an entire Enterprise Grid organization and may represent the user on multiple workspaces within it.

查看 Slack ID,例如 (W012A3CDE),它似乎符合以下规格:

如果以上都成立,我就不难区分用户名和id,即使在歧义的情况下,我也会允许使用@来解决歧义。

所以我的问题是:是否有关于 Slack 用户 ID 的规范public?

好吧,我终于找到了用于用户 ID 的 public Slack 正则表达式:

https://github.com/slackapi/slack-api-specs/blob/master/web-api/slack_web_openapi_v2.json#L106

    "defs_user_id": {
        "pattern": "^[UW][A-Z0-9]{8}$",
        "title": "User ID",
        "type": "string"
    },