kotori-plugin-github 1.2.0 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +24 -24
- package/lib/index.d.ts +1 -1
- package/lib/index.js +85 -40
- package/locales/en_US.json +5 -5
- package/locales/ja_JP.json +5 -5
- package/locales/zh_CN.json +5 -5
- package/locales/zh_TW.json +5 -5
- package/package.json +3 -6
package/README.md
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
# kotori-plugin-github
|
|
2
|
-
|
|
3
|
-
Github repository searching.
|
|
4
|
-
|
|
5
|
-
## Commands
|
|
6
|
-
|
|
7
|
-
- `/github <repository>` Query Github repository info
|
|
8
|
-
|
|
9
|
-
```text
|
|
10
|
-
/github kotorijs/kotori
|
|
11
|
-
> URL: kotorijs/kotori
|
|
12
|
-
Description: Cross platform, decoupled, and modernized ChatBot framework base on NodeJS
|
|
13
|
-
Language: TypeScript
|
|
14
|
-
Owner: kotorijs
|
|
15
|
-
Created: 2023-06-14T11:45:16Z
|
|
16
|
-
Last updated: 2024-01-30T09:55:47Z
|
|
17
|
-
Last push: 2024-02-03T12:51:17Z
|
|
18
|
-
Open source license: GNU General Public License v3.0
|
|
19
|
-
> [image,https://opengraph.githubassets.com/c9f4179f4d560950b2355c82aa2b7750bffd945744f9b8ea3f93cc24779745a0/kotorijs/kotori]
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
## Reference
|
|
23
|
-
|
|
24
|
-
- [Kotori Docs](https://kotori.js.org/)
|
|
1
|
+
# kotori-plugin-github
|
|
2
|
+
|
|
3
|
+
Github repository searching.
|
|
4
|
+
|
|
5
|
+
## Commands
|
|
6
|
+
|
|
7
|
+
- `/github <repository>` Query Github repository info
|
|
8
|
+
|
|
9
|
+
```text
|
|
10
|
+
/github kotorijs/kotori
|
|
11
|
+
> URL: kotorijs/kotori
|
|
12
|
+
Description: Cross platform, decoupled, and modernized ChatBot framework base on NodeJS
|
|
13
|
+
Language: TypeScript
|
|
14
|
+
Owner: kotorijs
|
|
15
|
+
Created: 2023-06-14T11:45:16Z
|
|
16
|
+
Last updated: 2024-01-30T09:55:47Z
|
|
17
|
+
Last push: 2024-02-03T12:51:17Z
|
|
18
|
+
Open source license: GNU General Public License v3.0
|
|
19
|
+
> [image,https://opengraph.githubassets.com/c9f4179f4d560950b2355c82aa2b7750bffd945744f9b8ea3f93cc24779745a0/kotorijs/kotori]
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Reference
|
|
23
|
+
|
|
24
|
+
- [Kotori Docs](https://kotori.js.org/)
|
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
|
@@ -1,44 +1,89 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* @Package kotori-plugin-github
|
|
4
|
+
* @Version 1.3.0
|
|
5
|
+
* @Author Hotaru <me@hotaru.icu>
|
|
6
|
+
* @Copyright 2024 Hotaru. All rights reserved.
|
|
7
|
+
* @License GPL-3.0
|
|
8
|
+
* @Link https://github.com/kotorijs/kotori
|
|
9
|
+
* @Date 2024/8/8 20:54:08
|
|
10
|
+
*/
|
|
11
|
+
|
|
1
12
|
"use strict";
|
|
2
|
-
Object.defineProperty
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
13
|
+
var __defProp = Object.defineProperty;
|
|
14
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
15
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
16
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
17
|
+
var __export = (target, all) => {
|
|
18
|
+
for (var name in all)
|
|
19
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
20
|
+
};
|
|
21
|
+
var __copyProps = (to, from, except, desc) => {
|
|
22
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
23
|
+
for (let key of __getOwnPropNames(from))
|
|
24
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
25
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
26
|
+
}
|
|
27
|
+
return to;
|
|
28
|
+
};
|
|
29
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
30
|
+
var src_exports = {};
|
|
31
|
+
__export(src_exports, {
|
|
32
|
+
lang: () => lang,
|
|
33
|
+
main: () => main
|
|
34
|
+
});
|
|
35
|
+
module.exports = __toCommonJS(src_exports);
|
|
36
|
+
var import_kotori_bot = require("kotori-bot");
|
|
37
|
+
var import_node_url = require("node:url");
|
|
38
|
+
const HEAD_URL = "https://opengraph.githubassets.com/c9f4179f4d560950b2355c82aa2b7750bffd945744f9b8ea3f93cc24779745a0";
|
|
39
|
+
const githubSchema = import_kotori_bot.Tsu.Union(
|
|
40
|
+
import_kotori_bot.Tsu.Object({
|
|
41
|
+
full_name: import_kotori_bot.Tsu.String(),
|
|
42
|
+
description: import_kotori_bot.Tsu.String().default("corei18n.template.empty"),
|
|
43
|
+
language: import_kotori_bot.Tsu.String().default("corei18n.template.empty"),
|
|
44
|
+
owner: import_kotori_bot.Tsu.Object({ login: import_kotori_bot.Tsu.String().default("corei18n.template.empty") }).default({
|
|
45
|
+
login: "corei18n.template.empty"
|
|
19
46
|
}),
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
47
|
+
created_at: import_kotori_bot.Tsu.String(),
|
|
48
|
+
updated_at: import_kotori_bot.Tsu.String(),
|
|
49
|
+
pushed_at: import_kotori_bot.Tsu.String(),
|
|
50
|
+
license: import_kotori_bot.Tsu.Object({ name: import_kotori_bot.Tsu.String().default("corei18n.template.empty") }).default({
|
|
51
|
+
name: "corei18n.template.empty"
|
|
52
|
+
})
|
|
53
|
+
}),
|
|
54
|
+
import_kotori_bot.Tsu.Object({})
|
|
55
|
+
);
|
|
56
|
+
const lang = [__dirname, "../locales"];
|
|
23
57
|
function main(ctx) {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
session.
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
58
|
+
ctx.command("github <content> - github.descr.github").action(async ({ args: [content] }, session) => {
|
|
59
|
+
if (content.split("/").length === 2) {
|
|
60
|
+
const res = githubSchema.parse(await ctx.http.get(`https://api.github.com/repos/${content}`));
|
|
61
|
+
if (!("full_name" in res)) {
|
|
62
|
+
return session.format("github.msg.github.fail", { input: content });
|
|
63
|
+
}
|
|
64
|
+
session.quick([
|
|
65
|
+
"github.msg.github",
|
|
66
|
+
{
|
|
67
|
+
name: res.full_name,
|
|
68
|
+
description: res.description,
|
|
69
|
+
language: res.language,
|
|
70
|
+
author: res.owner?.login,
|
|
71
|
+
create: res.created_at,
|
|
72
|
+
update: res.updated_at,
|
|
73
|
+
push: res.pushed_at,
|
|
74
|
+
license: res.license ? res.license.name : "BOT_RESULT.EMPTY"
|
|
75
|
+
}
|
|
76
|
+
]);
|
|
77
|
+
}
|
|
78
|
+
return import_kotori_bot.Messages.image(`${HEAD_URL}/${content}`);
|
|
79
|
+
});
|
|
80
|
+
ctx.regexp(/(https?:\/\/)?github.com\/[\w-]+\/[\w]+\/?(\/(pull|issues)\/\d+)?$/, (_, session) => {
|
|
81
|
+
const { pathname } = (0, import_node_url.parse)(session.message.toString());
|
|
82
|
+
return import_kotori_bot.Messages.image(`${HEAD_URL}${pathname}`);
|
|
83
|
+
});
|
|
43
84
|
}
|
|
44
|
-
|
|
85
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
86
|
+
0 && (module.exports = {
|
|
87
|
+
lang,
|
|
88
|
+
main
|
|
89
|
+
});
|
package/locales/en_US.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
{
|
|
2
|
-
"
|
|
3
|
-
"
|
|
4
|
-
"
|
|
5
|
-
"
|
|
1
|
+
{
|
|
2
|
+
"github.descr.github": "Query Github repository info",
|
|
3
|
+
"github.msg.github": "URL: %name%\nDescription: %description%\nLanguage: %language%\nOwner: %author%\nCreated: %create%\nLast updated: %update%\nLast push: %push%\nOpen source license: %license%",
|
|
4
|
+
"github.msg.github.image": "%image%",
|
|
5
|
+
"github.msg.github.fail": "Repository not found: %input%"
|
|
6
6
|
}
|
package/locales/ja_JP.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
{
|
|
2
|
-
"
|
|
3
|
-
"
|
|
4
|
-
"
|
|
5
|
-
"
|
|
1
|
+
{
|
|
2
|
+
"github.descr.github": "Githubリポジトリ情報を検索",
|
|
3
|
+
"github.msg.github": "アドレス:%name%\n説明:%description%\n言語:%language%\n所有者:%author%\n作成日時:%create%\n最終更新日時:%update%\n最終プッシュ日時:%push%\nオープンソースライセンス:%license%",
|
|
4
|
+
"github.msg.github.image": "%image%",
|
|
5
|
+
"github.msg.github.fail": "リポジトリが見つかりません:%input%"
|
|
6
6
|
}
|
package/locales/zh_CN.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
{
|
|
2
|
-
"
|
|
3
|
-
"
|
|
4
|
-
"
|
|
5
|
-
"
|
|
1
|
+
{
|
|
2
|
+
"github.descr.github": "查询Github仓库信息",
|
|
3
|
+
"github.msg.github": "地址:%name%\n描述:%description%\n语言:%language%\n所有者:%author%\n创建时间:\n %create%\n最后更新时间:%update%\n最后推送时间:%push%\n开源协议:%license%",
|
|
4
|
+
"github.msg.github.image": "%image%",
|
|
5
|
+
"github.msg.github.fail": "未找到仓库:%input%"
|
|
6
6
|
}
|
package/locales/zh_TW.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
{
|
|
2
|
-
"
|
|
3
|
-
"
|
|
4
|
-
"
|
|
5
|
-
"
|
|
1
|
+
{
|
|
2
|
+
"github.descr.github": "查詢Github倉庫信息",
|
|
3
|
+
"github.msg.github": "地址:%name%\n描述:%description%\n語言:%language%\n所有者:%author%\n創建時間:\n %create%\n最後更新時間:%update%\n最後推送時間:%push%\n開源協議:%license%",
|
|
4
|
+
"github.msg.github.image": "%image%",
|
|
5
|
+
"github.msg.github.fail": "未找到倉庫:%input%"
|
|
6
6
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "kotori-plugin-github",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "github repository searching",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"keywords": [
|
|
@@ -15,9 +15,9 @@
|
|
|
15
15
|
"LICENSE",
|
|
16
16
|
"README.md"
|
|
17
17
|
],
|
|
18
|
-
"author": "Hotaru <
|
|
18
|
+
"author": "Hotaru <me@hotaru.icu>",
|
|
19
19
|
"peerDependencies": {
|
|
20
|
-
"kotori-bot": "^
|
|
20
|
+
"kotori-bot": "^1.6.0-rc.1"
|
|
21
21
|
},
|
|
22
22
|
"kotori": {
|
|
23
23
|
"meta": {
|
|
@@ -28,8 +28,5 @@
|
|
|
28
28
|
"zh_CN"
|
|
29
29
|
]
|
|
30
30
|
}
|
|
31
|
-
},
|
|
32
|
-
"scripts": {
|
|
33
|
-
"build": "tsc --build"
|
|
34
31
|
}
|
|
35
32
|
}
|