显示有关 GitHub 次提交的信息
Display info about GitHub commits
所以,我有一个 discord 机器人,我希望使用的命令之一是让用户了解我在 github 上制作的游戏的最新更新,我的问题是,有没有办法获取最新提交的名称和描述?
我假设它使用 superagent 但除此之外我就迷路了。
我建议您使用 webhooks post 每次提交到特定频道。
为此,我post编辑了Discord 中的教程。
(要通过教程获取图片,请查看Discord教程。
- Get the webhook URL for the server/channel you want to receive messages:
In my server, I've created a text channel labeled #gitupdates. I want
my repo updates to post messages here, so I'll grab the webhook URL
for this channel:
- Add the webhook URL into your GitHub repo settings
Choose the repository that you'd like to get updates from in your
Discord server. Once you've selected the repo, go into the settings >
webhooks menu:
Sweet. Click the "Add webhook" button, and enter the Discord-generated
URL in the "Payload URL" blank.
To make the webhook display messages properly, it's really important that you append '/github' at the end of
it.
In addition to the URL, you have
some more GitHub-specific options to choose from. For content type,
stick with application/json. Discord's webhook format really likes
JSON. In the next section, you can choose to customize what kind of
events trigger webhook messages.
Click the last "Add webhook" button beneath the event notifications
customization option, and you're all set! Pushing any updates in the
repo (including editing the readme file) will show up in your text
channel:
And you're all set!
所以,我有一个 discord 机器人,我希望使用的命令之一是让用户了解我在 github 上制作的游戏的最新更新,我的问题是,有没有办法获取最新提交的名称和描述?
我假设它使用 superagent 但除此之外我就迷路了。
我建议您使用 webhooks post 每次提交到特定频道。
为此,我post编辑了Discord 中的教程。 (要通过教程获取图片,请查看Discord教程。
- Get the webhook URL for the server/channel you want to receive messages:
In my server, I've created a text channel labeled #gitupdates. I want my repo updates to post messages here, so I'll grab the webhook URL for this channel:
- Add the webhook URL into your GitHub repo settings
Choose the repository that you'd like to get updates from in your Discord server. Once you've selected the repo, go into the settings > webhooks menu:
Sweet. Click the "Add webhook" button, and enter the Discord-generated URL in the "Payload URL" blank.
To make the webhook display messages properly, it's really important that you append '/github' at the end of it.
In addition to the URL, you have some more GitHub-specific options to choose from. For content type, stick with application/json. Discord's webhook format really likes JSON. In the next section, you can choose to customize what kind of events trigger webhook messages.
Click the last "Add webhook" button beneath the event notifications customization option, and you're all set! Pushing any updates in the repo (including editing the readme file) will show up in your text channel:
And you're all set!