Skip to content
This repository has been archived by the owner on Dec 26, 2020. It is now read-only.

Commit

Permalink
Merge pull request #3 from EnkanRec/dev
Browse files Browse the repository at this point in the history
New Features
  • Loading branch information
Inactive Virus authored Dec 13, 2020
2 parents e11a8f8 + 13efefb commit 2b22e0e
Show file tree
Hide file tree
Showing 54 changed files with 2,082 additions and 1,040 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/fridge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Fridge

on:
push:
branches:
- dev
paths:
- 'fridge/fridge-src/**'

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Build with Maven
run: mvn -B package --file fridge/fridge-src/pom.xml -Dmaven.test.skip=true
- name: Moving builds to artifacts directory
run: |
mkdir -p artifacts/fridge
cp fridge/fridge-src/target/*.jar artifacts/fridge
- uses: actions/upload-artifact@v1
with:
name: fridge
path: artifacts/fridge
32 changes: 32 additions & 0 deletions .github/workflows/koishi-app.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: koishi-app

on:
push:
branches:
- dev
paths:
- 'koishi-app/src/**'
- 'koishi-app/tsconfig.json'

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: '12.x'
- name: Build with tsc
run: |
npm install --prefix koishi-app
npm run build --prefix koishi-app
- name: Moving builds to artifacts directory
run: |
mkdir -p artifacts/koishi-app
cp -r koishi-app/dist artifacts/koishi-app
- uses: actions/upload-artifact@v1
with:
name: koishi-app
path: artifacts/koishi-app
30 changes: 30 additions & 0 deletions .github/workflows/oven.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Oven

on:
push:
branches:
- dev
paths:
- 'oven/baker/**'

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: '12.x'
- name: Build with yarn
run: |
npm install yarn -g
yarn --cwd oven/baker install
yarn --cwd oven/baker build
- name: Moving builds to artifacts directory
run: |
mkdir -p artifacts/oven
cp -r oven/baker/dist artifacts/oven
- uses: actions/upload-artifact@v1
with:
name: oven
path: artifacts/oven
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Also provides the ability to detect whether Bilibili Dynamics has released an ou
## front-end components

### koishi-app
QQBot front-end, based on [koishi](koishi.js.org) framework to communicate with CoolQ robot, provides QQ update notification, translation submission and image return services.
QQBot front-end, based on [koishi](https://koishi.js.org) framework to communicate with CoolQ robot, provides QQ update notification, translation submission and image return services.

## install
See README.md in each subfolder; shell scripts are available in the repository for quick deployments. To use them, please give sudo privileges to the appropriate users and recommend revoking them after deployment is complete.
Empty file modified fridge/build.sh
100644 → 100755
Empty file.
Empty file modified fridge/configen.sh
100644 → 100755
Empty file.
Empty file modified fridge/db_init.sh
100644 → 100755
Empty file.
Empty file.
2 changes: 1 addition & 1 deletion fridge/fridge-src/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
</parent>
<groupId>com.enkanRec</groupId>
<artifactId>twitkit-fridge</artifactId>
<version>0.0.1-SNAPSHOT</version>
<version>0.0.1</version>
<name>twitkit-fridge</name>
<description>twitkit-fridge for EnkanRec</description>

Expand Down
Empty file modified fridge/start.sh
100644 → 100755
Empty file.
Empty file modified fridge/test_init.sh
100644 → 100755
Empty file.
1 change: 0 additions & 1 deletion koishi-app/.gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
package-lock.json
node_modules/
dist/
/koishi.config.js
4 changes: 2 additions & 2 deletions koishi-app/.koishi.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module.exports = {
logLevel: 3,
logLevel: 2,
type: "ws",
server: "ws://localhost:6700",
selfId: undefined,
Expand Down Expand Up @@ -27,7 +27,7 @@ module.exports = {
},
group: [], // 监听命令的群组,留空监听所有人
private: false, // 是否允许私聊上班
friend: true, // 是否允许好友上班
friend: false, // 是否允许好友上班
cut: 8 // 消息预览截断长度
},
watcher: {
Expand Down
40 changes: 24 additions & 16 deletions koishi-app/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@

#### 短指令/快捷命令

基本格式 `"指令前缀[任务id][指令符] [附加文字]"`
<detail>
<summary>基本格式 `"指令前缀[任务id][指令符] [附加文字]"`</summary>

除了附加文字,各部分之间没有空格

Expand All @@ -41,10 +42,12 @@
| id | 翻译 | 更新该任务翻译 | #1000 [翻译] | translate 1000 [翻译] |
| url | <无> | 将指定链接的推文入库 | #<https://twitter.com/any/status/12345> | fetch [url] |
| url | 翻译 | 直接对链接烤图 | #<https://twitter.com/any/status/12345> [翻译] | fetch [url] [翻译] |
</detail>

#### 长指令

指令前缀参考koishi指令帮助,默认为空,可以在群聊中直接使用如 `undo`
<detail>
<summary>指令前缀参考koishi指令帮助,默认为空,可以在群聊中直接使用如 `undo`</summary>

指令前缀

Expand All @@ -62,10 +65,12 @@
| undo | undo [tid] | 撤销某个推的翻译修改,id为空时,撤销最近修改过的翻译 |
| delete| delete &lt;tid&gt; | 删除一个任务,返回是否删除成功,建议使用hide隐藏 |
| how | how | 显示内置帮助 |
</detail>

### 监听器

REST基本请求格式:
<detail>
<summary>REST基本请求格式:</summary>

HTTP method: `POST`

Expand All @@ -79,18 +84,22 @@ body:(均非空)
| timestamp | string | ISO8601格式的日期字符串 |
| taskId | string | 一个uuid,用于调试跟踪执行过程 |
| data | any | 接口需要的数据,见下 |
</detail>

#### 推特更新

路由:`/api/app/twitter`
<detail>
<summary>路由:`/api/app/twitter`</summary>

data: number[] 所有新到达的任务id

通知app有哪些新任务
</detail>

#### 其他更新

路由:`/api/app/other`
<detail>
<summary>路由:`/api/app/other`</summary>

data: dict (无注明既可空说)其他更新的详细信息

Expand All @@ -105,36 +114,37 @@ data: dict (无注明既可空说)其他更新的详细信息
| postDate | string | 发布日期,ISO8601格式 |

将非任务更新,推送给app以便在群里通知
</detail>

## 输出接口

### 数据库

`store.ts``twitkit-fridge`
`store.ts`

### 烤推机

`translator.ts``twitkit-oven`
`translator.ts`

## 配置

```js
{
twid: "", // 监听推主
prefix: '#', // 快捷指令前缀
ispro: false, // 是否发图
cmd: {
host: { // 其他组件的REST监听HOST
translator: "http://localhost",
store: "http://localhost"
store: "http://localhost:8220",
translator: "http://localhost:8221",
maid: "http://localhost:8222",
},
group: [], // 监听命令的群组,留空监听所有人
private: true, // 是否允许私聊上班
friend: true, // 是否允许好友上班
cut: 8 // 消息预览截断长度
},
watcher: {
port: 1551, // 监视器推送端口
port: 8223, // 监视器推送端口
target: { // 监视器更新推送目标
discuss: [],
private: [],
Expand All @@ -147,9 +157,7 @@ data: dict (无注明既可空说)其他更新的详细信息
## 启动

1. 安装[koishi](https://koishi.js.org/)

2. 安装依赖 `npm install`

3. 编写配置,参考 `koishi.config.js`

4. 运行 `npm run dev`
3. 编写配置,参考 `.koishi.config.js`
4. 编译 `npm run build`
5. 运行 `koishi run``npm run dev`
Empty file modified koishi-app/configen.sh
100644 → 100755
Empty file.
Loading

0 comments on commit 2b22e0e

Please sign in to comment.