koishijs / koishi-plugin-github

GitHub Toolkit for Koishi
https://github.koishi.chat
MIT License
8 stars 3 forks source link

Bug: 无法发送消息 #37

Open null-qwerty opened 6 months ago

null-qwerty commented 6 months ago

按文档配置了插件,群聊中已订阅仓库。github webhook 发送请求后能接收到 response,但不会往群聊中发送消息。能正常使用插件新建 issue。

c1a50c2e5367fe51686d9a4ccd49a933

环境信息

System:
    OS: Linux 5.4 Alpine Linux
    CPU: (2) x64 Intel(R) Xeon(R) CPU E5-2682 v4 @ 2.50GHz

Binaries:
    Node: 20.9.0
    Yarn: 4.0.1

Koishi:
    Core: 4.17.1
    Console: 5.26.0

github webhook payload

{
  "action": "created",
  "issue": {
    "url": "https://api.github.com/repos/null-qwerty/null-qwerty/issues/9",
    "repository_url": "https://api.github.com/repos/null-qwerty/null-qwerty",
    "labels_url": "https://api.github.com/repos/null-qwerty/null-qwerty/issues/9/labels{/name}",
    "comments_url": "https://api.github.com/repos/null-qwerty/null-qwerty/issues/9/comments",
    "events_url": "https://api.github.com/repos/null-qwerty/null-qwerty/issues/9/events",
    "html_url": "https://github.com/null-qwerty/null-qwerty/issues/9",
    "id": 2152638646,
    "node_id": "I_kwDOK4YM4c6ATqi2",
    "number": 9,
    "title": "5",
    "user": {
      "login": "null-qwerty",
      "id": 114760660,
      "node_id": "U_kgDOBtcb1A",
      "avatar_url": "https://avatars.githubusercontent.com/u/114760660?v=4",
      "gravatar_id": "",
      "url": "https://api.github.com/users/null-qwerty",
      "html_url": "https://github.com/null-qwerty",
      "followers_url": "https://api.github.com/users/null-qwerty/followers",
      "following_url": "https://api.github.com/users/null-qwerty/following{/other_user}",
      "gists_url": "https://api.github.com/users/null-qwerty/gists{/gist_id}",
      "starred_url": "https://api.github.com/users/null-qwerty/starred{/owner}{/repo}",
      "subscriptions_url": "https://api.github.com/users/null-qwerty/subscriptions",
      "organizations_url": "https://api.github.com/users/null-qwerty/orgs",
      "repos_url": "https://api.github.com/users/null-qwerty/repos",
      "events_url": "https://api.github.com/users/null-qwerty/events{/privacy}",
      "received_events_url": "https://api.github.com/users/null-qwerty/received_events",
      "type": "User",
      "site_admin": false
    },
    "labels": [

    ],
    "state": "open",
    "locked": false,
    "assignee": null,
    "assignees": [

    ],
    "milestone": null,
    "comments": 5,
    "created_at": "2024-02-25T07:24:05Z",
    "updated_at": "2024-03-02T06:47:32Z",
    "closed_at": null,
    "author_association": "OWNER",
    "active_lock_reason": null,
    "body": "5",
    "reactions": {
      "url": "https://api.github.com/repos/null-qwerty/null-qwerty/issues/9/reactions",
      "total_count": 0,
      "+1": 0,
      "-1": 0,
      "laugh": 0,
      "hooray": 0,
      "confused": 0,
      "heart": 0,
      "rocket": 0,
      "eyes": 0
    },
    "timeline_url": "https://api.github.com/repos/null-qwerty/null-qwerty/issues/9/timeline",
    "performed_via_github_app": null,
    "state_reason": "reopened"
  },
  "comment": {
    "url": "https://api.github.com/repos/null-qwerty/null-qwerty/issues/comments/1974462858",
    "html_url": "https://github.com/null-qwerty/null-qwerty/issues/9#issuecomment-1974462858",
    "issue_url": "https://api.github.com/repos/null-qwerty/null-qwerty/issues/9",
    "id": 1974462858,
    "node_id": "IC_kwDOK4YM4c51r-mK",
    "user": {
      "login": "null-qwerty",
      "id": 114760660,
      "node_id": "U_kgDOBtcb1A",
      "avatar_url": "https://avatars.githubusercontent.com/u/114760660?v=4",
      "gravatar_id": "",
      "url": "https://api.github.com/users/null-qwerty",
      "html_url": "https://github.com/null-qwerty",
      "followers_url": "https://api.github.com/users/null-qwerty/followers",
      "following_url": "https://api.github.com/users/null-qwerty/following{/other_user}",
      "gists_url": "https://api.github.com/users/null-qwerty/gists{/gist_id}",
      "starred_url": "https://api.github.com/users/null-qwerty/starred{/owner}{/repo}",
      "subscriptions_url": "https://api.github.com/users/null-qwerty/subscriptions",
      "organizations_url": "https://api.github.com/users/null-qwerty/orgs",
      "repos_url": "https://api.github.com/users/null-qwerty/repos",
      "events_url": "https://api.github.com/users/null-qwerty/events{/privacy}",
      "received_events_url": "https://api.github.com/users/null-qwerty/received_events",
      "type": "User",
      "site_admin": false
    },
    "created_at": "2024-03-02T06:47:31Z",
    "updated_at": "2024-03-02T06:47:31Z",
    "author_association": "OWNER",
    "body": "123456",
    "reactions": {
      "url": "https://api.github.com/repos/null-qwerty/null-qwerty/issues/comments/1974462858/reactions",
      "total_count": 0,
      "+1": 0,
      "-1": 0,
      "laugh": 0,
      "hooray": 0,
      "confused": 0,
      "heart": 0,
      "rocket": 0,
      "eyes": 0
    },
    "performed_via_github_app": null
  },
  "repository": {
    "id": 730205409,
    "node_id": "R_kgDOK4YM4Q",
    "name": "null-qwerty",
    "full_name": "null-qwerty/null-qwerty",
    "private": false,
    "owner": {
      "login": "null-qwerty",
      "id": 114760660,
      "node_id": "U_kgDOBtcb1A",
      "avatar_url": "https://avatars.githubusercontent.com/u/114760660?v=4",
      "gravatar_id": "",
      "url": "https://api.github.com/users/null-qwerty",
      "html_url": "https://github.com/null-qwerty",
      "followers_url": "https://api.github.com/users/null-qwerty/followers",
      "following_url": "https://api.github.com/users/null-qwerty/following{/other_user}",
      "gists_url": "https://api.github.com/users/null-qwerty/gists{/gist_id}",
      "starred_url": "https://api.github.com/users/null-qwerty/starred{/owner}{/repo}",
      "subscriptions_url": "https://api.github.com/users/null-qwerty/subscriptions",
      "organizations_url": "https://api.github.com/users/null-qwerty/orgs",
      "repos_url": "https://api.github.com/users/null-qwerty/repos",
      "events_url": "https://api.github.com/users/null-qwerty/events{/privacy}",
      "received_events_url": "https://api.github.com/users/null-qwerty/received_events",
      "type": "User",
      "site_admin": false
    },
    "html_url": "https://github.com/null-qwerty/null-qwerty",
    "description": null,
    "fork": false,
    "url": "https://api.github.com/repos/null-qwerty/null-qwerty",
    "forks_url": "https://api.github.com/repos/null-qwerty/null-qwerty/forks",
    "keys_url": "https://api.github.com/repos/null-qwerty/null-qwerty/keys{/key_id}",
    "collaborators_url": "https://api.github.com/repos/null-qwerty/null-qwerty/collaborators{/collaborator}",
    "teams_url": "https://api.github.com/repos/null-qwerty/null-qwerty/teams",
    "hooks_url": "https://api.github.com/repos/null-qwerty/null-qwerty/hooks",
    "issue_events_url": "https://api.github.com/repos/null-qwerty/null-qwerty/issues/events{/number}",
    "events_url": "https://api.github.com/repos/null-qwerty/null-qwerty/events",
    "assignees_url": "https://api.github.com/repos/null-qwerty/null-qwerty/assignees{/user}",
    "branches_url": "https://api.github.com/repos/null-qwerty/null-qwerty/branches{/branch}",
    "tags_url": "https://api.github.com/repos/null-qwerty/null-qwerty/tags",
    "blobs_url": "https://api.github.com/repos/null-qwerty/null-qwerty/git/blobs{/sha}",
    "git_tags_url": "https://api.github.com/repos/null-qwerty/null-qwerty/git/tags{/sha}",
    "git_refs_url": "https://api.github.com/repos/null-qwerty/null-qwerty/git/refs{/sha}",
    "trees_url": "https://api.github.com/repos/null-qwerty/null-qwerty/git/trees{/sha}",
    "statuses_url": "https://api.github.com/repos/null-qwerty/null-qwerty/statuses/{sha}",
    "languages_url": "https://api.github.com/repos/null-qwerty/null-qwerty/languages",
    "stargazers_url": "https://api.github.com/repos/null-qwerty/null-qwerty/stargazers",
    "contributors_url": "https://api.github.com/repos/null-qwerty/null-qwerty/contributors",
    "subscribers_url": "https://api.github.com/repos/null-qwerty/null-qwerty/subscribers",
    "subscription_url": "https://api.github.com/repos/null-qwerty/null-qwerty/subscription",
    "commits_url": "https://api.github.com/repos/null-qwerty/null-qwerty/commits{/sha}",
    "git_commits_url": "https://api.github.com/repos/null-qwerty/null-qwerty/git/commits{/sha}",
    "comments_url": "https://api.github.com/repos/null-qwerty/null-qwerty/comments{/number}",
    "issue_comment_url": "https://api.github.com/repos/null-qwerty/null-qwerty/issues/comments{/number}",
    "contents_url": "https://api.github.com/repos/null-qwerty/null-qwerty/contents/{+path}",
    "compare_url": "https://api.github.com/repos/null-qwerty/null-qwerty/compare/{base}...{head}",
    "merges_url": "https://api.github.com/repos/null-qwerty/null-qwerty/merges",
    "archive_url": "https://api.github.com/repos/null-qwerty/null-qwerty/{archive_format}{/ref}",
    "downloads_url": "https://api.github.com/repos/null-qwerty/null-qwerty/downloads",
    "issues_url": "https://api.github.com/repos/null-qwerty/null-qwerty/issues{/number}",
    "pulls_url": "https://api.github.com/repos/null-qwerty/null-qwerty/pulls{/number}",
    "milestones_url": "https://api.github.com/repos/null-qwerty/null-qwerty/milestones{/number}",
    "notifications_url": "https://api.github.com/repos/null-qwerty/null-qwerty/notifications{?since,all,participating}",
    "labels_url": "https://api.github.com/repos/null-qwerty/null-qwerty/labels{/name}",
    "releases_url": "https://api.github.com/repos/null-qwerty/null-qwerty/releases{/id}",
    "deployments_url": "https://api.github.com/repos/null-qwerty/null-qwerty/deployments",
    "created_at": "2023-12-11T12:31:23Z",
    "updated_at": "2023-12-11T12:31:24Z",
    "pushed_at": "2024-03-02T06:08:24Z",
    "git_url": "git://github.com/null-qwerty/null-qwerty.git",
    "ssh_url": "git@github.com:null-qwerty/null-qwerty.git",
    "clone_url": "https://github.com/null-qwerty/null-qwerty.git",
    "svn_url": "https://github.com/null-qwerty/null-qwerty",
    "homepage": null,
    "size": 30,
    "stargazers_count": 0,
    "watchers_count": 0,
    "language": null,
    "has_issues": true,
    "has_projects": true,
    "has_downloads": true,
    "has_wiki": true,
    "has_pages": false,
    "has_discussions": false,
    "forks_count": 0,
    "mirror_url": null,
    "archived": false,
    "disabled": false,
    "open_issues_count": 1,
    "license": null,
    "allow_forking": true,
    "is_template": false,
    "web_commit_signoff_required": false,
    "topics": [

    ],
    "visibility": "public",
    "forks": 0,
    "open_issues": 1,
    "watchers": 0,
    "default_branch": "main"
  },
  "sender": {
    "login": "null-qwerty",
    "id": 114760660,
    "node_id": "U_kgDOBtcb1A",
    "avatar_url": "https://avatars.githubusercontent.com/u/114760660?v=4",
    "gravatar_id": "",
    "url": "https://api.github.com/users/null-qwerty",
    "html_url": "https://github.com/null-qwerty",
    "followers_url": "https://api.github.com/users/null-qwerty/followers",
    "following_url": "https://api.github.com/users/null-qwerty/following{/other_user}",
    "gists_url": "https://api.github.com/users/null-qwerty/gists{/gist_id}",
    "starred_url": "https://api.github.com/users/null-qwerty/starred{/owner}{/repo}",
    "subscriptions_url": "https://api.github.com/users/null-qwerty/subscriptions",
    "organizations_url": "https://api.github.com/users/null-qwerty/orgs",
    "repos_url": "https://api.github.com/users/null-qwerty/repos",
    "events_url": "https://api.github.com/users/null-qwerty/events{/privacy}",
    "received_events_url": "https://api.github.com/users/null-qwerty/received_events",
    "type": "User",
    "site_admin": false
  }
}
shigma commented 6 months ago

没有报错吗?

null-qwerty commented 6 months ago

没有报错吗?

没有

darwintree commented 5 months ago

相同的问题。我开了debug模式看了一下日志。原因可能在数据库里 image 数据库对应表内容 image id是对不上的

我在源码里没找到具体是调用的哪一段代码

![image](https://github.com/koishijs/koishi-plugin-github/assets/17946284/a45012aa-72f8-462d-b499-65c5c9964c9d)

但从黑盒的角度看,需要做的事情是

  1. 比较secret
  2. 从数据库找出订阅了这个仓库的频道 看起来是哪里出问题了