Skip to content

Commit

Permalink
Merge pull request #325 from Giftia/dev
Browse files Browse the repository at this point in the history
v3.6.5
  • Loading branch information
Giftia authored Aug 5, 2022
2 parents 308c9d7 + 92b272d commit 1389f5f
Show file tree
Hide file tree
Showing 10 changed files with 113 additions and 36 deletions.
72 changes: 72 additions & 0 deletions .github/workflows/Incremental-update.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: Build Incremental Update Package On Windows (Windows 增量更新包)
on:
push:
branches:
- master

env:
GITHUB_TOKEN: ${{ github.token }}

jobs:
build:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- name: Use Node.js v14
uses: actions/setup-node@v3
with:
node-version: 14
architecture: x64
cache: "npm"
cache-dependency-path: ./packages-lock.json

- name: Remove conflicting files
run: rm ./plugins/go-cqhttp/

- name: Clean Install Modules
run: npm ci --production

- name: Install pkg Tool
run: npm i pkg -g

- name: Use pkg To Package
run: pkg -t . --compress Brotli

- name: Declare VERSION
shell: bash
run: |
node -e "
const fs = require('fs');
const version = require('./version.json');
fs.writeFileSync('version-number', 'VERSION_NUMBER=' + version.versionNumber);
"
cat ./version-number >> $GITHUB_ENV
- name: Pre-compress
shell: bash
run: |
npm i archiver
node -e "
const archiver = require('archiver');
const fs = require('fs');
const path = require('path');
const output = fs.createWriteStream(path.join(__dirname, 'ChatDACS-${{ env.VERSION_NUMBER }}_Incremental-Update-Package.zip'));
const archive = archiver('zip', {
zlib: { level: 9 } // Sets the compression level. 9 is the max compression.
});
archive.pipe(output);
archive.directory('./plugins/', 'plugins');
archive.file('./chatdacs.exe', { name: 'chatdacs.exe' });
archive.finalize();
"
- name: Get Current Time
id: time
run: echo "::set-output name=now::$(date +'%Y-%m-%d-%H-%M-%S')"

- name: Upload Build Artifact
uses: actions/upload-artifact@v3
with:
name: ChatDACS-${{ env.VERSION_NUMBER }}_Incremental-Update-Package-${{ steps.time.outputs.now }}
path: ChatDACS-${{ env.VERSION_NUMBER }}_Incremental-Update-Package.zip
if-no-files-found: error
7 changes: 6 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,14 @@ jobs:
./packages-lock.json
plugins/package-lock.json
- name: Remove Other Platforms go-cqhttp
- name: Remove go-cqhttp On Windows
if: runner.os == 'Windows'
run: rm ./plugins/go-cqhttp/go-cqhttp

- name: Remove go-cqhttp.exe On Linux
if: runner.os == 'Linux'
run: rm ./plugins/go-cqhttp/go-cqhttp_windows_amd64.exe

- name: Clean Install Modules
run: |
npm ci --production
Expand Down
23 changes: 10 additions & 13 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,7 @@ async function StartQQBot() {
axios.get(
`http://${GO_CQHTTP_SERVICE_API_URL}/get_group_member_info?group_id=${event.group_id}&user_id=${event.user_id}`
).then(async (response) => {
if (response.role === "owner" || response.role === "admin") {
if (response.data.data.role === "owner" || response.data.data.role === "admin") {
logger.info(
`群 ${event.group_id} 启用了小夜服务`.log
);
Expand Down Expand Up @@ -1768,14 +1768,14 @@ function StartHttpServer() {
`服务启动完毕,访问 127.0.0.1:${WEB_PORT} 即可进入本地web端\n`,
);
});

http.on("error", (err) => {
http.close();
logger.error(`本机${WEB_PORT}端口被其他应用程序占用,稍后会自动重试,请尝试关闭占用${WEB_PORT}端口的其他程序 或 修改配置文件的 WEB_PORT 配置项。错误代码:${err.code}`.error);
setTimeout(() => StartHttpServer(), 10000);
});
};

http.on("error", (err) => {
http.close();
logger.error(`本机${WEB_PORT}端口被其他应用程序占用,稍后会自动重试,请尝试关闭占用${WEB_PORT}端口的其他程序 或 修改配置文件的 WEB_PORT 配置项。错误代码:${err.code}`.error);
setTimeout(() => StartHttpServer(), 10000);
});

const UnauthorizedHttpsAgent = new https.Agent({ rejectUnauthorized: false }); // #303,Watt Toolkit(Steam++)的自签证书问题

/**
Expand All @@ -1791,8 +1791,7 @@ function CheckUpdate() {
logger.info(`当前小夜已经是最新发行版本 ${versionNumber}`.log);
}
}).catch((err) => {
logger.error(`检查小夜更新失败,稍后会自动重试,错误原因: ${err}`.error);
setTimeout(() => CheckUpdate(), 10000);
logger.error(`检查小夜更新失败,错误原因: ${err}`.error);
});
}

Expand All @@ -1814,12 +1813,10 @@ function CheckGoCqhttpUpdate() {
}
})
.catch((err) => {
logger.error(`检查 go-cqhttp 更新失败,稍后会自动重试,错误原因: ${err}`.error);
setTimeout(() => CheckGoCqhttpUpdate(), 10000);
logger.error(`检查 go-cqhttp 更新失败,错误原因: ${err}`.error);
});
}).catch((err) => {
logger.error(`检查 go-cqhttp 更新失败,稍后会自动重试,错误原因: ${err}`.error);
setTimeout(() => CheckGoCqhttpUpdate(), 10000);
logger.error(`检查 go-cqhttp 更新失败,错误原因: ${err}`.error);
});
}

Expand Down
9 changes: 6 additions & 3 deletions plugins/poHaiGenerate.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
module.exports = {
插件名: "迫害生草图生成器插件",
指令: "^[/!]?迫害 (.*)",
版本: "2.2",
版本: "2.3",
作者: "Giftina",
描述: "让小夜来制作缺德的迫害表情包吧。现在可以迫害的对象:唐可可,上原步梦,猛男狗,令和,鸭鸭,陈睿,寄。",
使用示例: "/迫害 上原步梦 是我,是我先,明明都是我先来的……接吻也好,拥抱也好,还是喜欢上那家伙也好。",
描述: "让小夜来制作缺德的迫害表情包吧。现在可以迫害的对象:唐可可,上原步梦,猛男狗,令和,鸭鸭,陈睿,寄,吴京,星星,安详。",
使用示例: "迫害 上原步梦 是我,是我先,明明都是我先来的……接吻也好,拥抱也好,还是喜欢上那家伙也好。",
预期返回: "[一张迫害生草图]",

execute: async function (msg, userId, userName, groupId, groupName, options) {
Expand All @@ -19,6 +19,9 @@ module.exports = {
鸭鸭: { pictureName: "yaya.gif", textPosition: { textAlign: "center", left: "30", top: "30", rotate: "0", wordPerLine: "2", fontsize: "30" } },
陈睿: { pictureName: "bilibili.png", textPosition: { textAlign: "center", left: "92", top: "385", rotate: "-0.01", wordPerLine: "12", fontsize: "14" } },
: { pictureName: "ji.jpg", textPosition: { textAlign: "center", left: "-3", top: "150", rotate: "-0.3", wordPerLine: "1", fontsize: "50" } },
吴京: { pictureName: "wujing.jpg", textPosition: { textAlign: "center", left: "111", top: "150", rotate: "0", wordPerLine: "14", fontsize: "15" } },
星星: { pictureName: "star.jpg", textPosition: { textAlign: "center", left: "200", top: "345", rotate: "0", wordPerLine: "15", fontsize: "20" } },
安详: { pictureName: "sleep.jpg", textPosition: { textAlign: "left", left: "300", top: "350", rotate: "-0.2", wordPerLine: "20", fontsize: "20" } },
};

const defaultPohaiTarget = pohaiList.唐可可;
Expand Down
2 changes: 1 addition & 1 deletion plugins/system/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ module.exports = {
});

if (!groupList) {
setTimeout(() => this.InitGroupList(), 10000);
setTimeout(() => this.InitGroupList(), 20000);
return;
} else {
const groupIdList = groupList.map((group) => group.group_id);
Expand Down
34 changes: 17 additions & 17 deletions plugins/tray.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,22 +34,6 @@ async function runTray() {
icon: fs.readFileSync(icon),
});

const openConfigFile = newTray.item("打开配置文件", async () => {
const configFile = path.join(`${process.cwd()}`, "config", "config.yml");
if (fs.existsSync(configFile)) {
console.log(`打开配置文件:${configFile}`);
exec(`notepad ${configFile}`, {
cwd: path.join(process.cwd(), "config")
});
} else {
newTray.notify("配置文件不存在", "是不是哪里出问题了, 建议重开");
}
});

const newPlugin = newTray.item("新建插件", async () => {
// 用插件模板新建插件,之后再写
});

const reloadGoCqhttp = newTray.item("重启 go-cqhttp", async () => {
exec("go-cqhttp.bat", {
cwd: path.join(process.cwd(), "plugins", "go-cqhttp"),
Expand All @@ -64,6 +48,22 @@ async function runTray() {
});
});

const openConfigFile = newTray.item("打开配置文件", async () => {
const configFile = path.join(`${process.cwd()}`, "config", "config.yml");
if (fs.existsSync(configFile)) {
console.log(`打开配置文件:${configFile}`);
exec(`notepad ${configFile}`, {
cwd: path.join(process.cwd(), "config")
});
} else {
newTray.notify("配置文件不存在", "是不是哪里出问题了, 建议重开");
}
});

const checkUpdate = newTray.item("检查更新", async () => {
newTray.notify("还没写,等等吧");
});

const separator = newTray.separator();

const quit = newTray.item("退出", () => {
Expand All @@ -72,7 +72,7 @@ async function runTray() {
process.exit(0);
});

newTray.setMenu(reloadGoCqhttp, openConfigFile, separator, quit);
newTray.setMenu(reloadGoCqhttp, openConfigFile, checkUpdate, separator, quit);

newTray.notify("world.execute(me);", "=> Master,小夜已启动。");

Expand Down
Binary file removed static/xiaoye/ps/bilibili_orgin.png
Binary file not shown.
Binary file removed static/xiaoye/ps/gugu.jpg
Binary file not shown.
Binary file removed static/xiaoye/ps/nokia.jpg
Binary file not shown.
2 changes: 1 addition & 1 deletion version.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{ "versionNumber": "v3.6.4-fix" }
{ "versionNumber": "v3.6.5" }

0 comments on commit 1389f5f

Please sign in to comment.