v7.2@uwuzu1.5.4をリリース
This commit is contained in:
+16
-10
@@ -1,35 +1,41 @@
|
||||
import * as fs from "fs";
|
||||
import config from "../config.js";
|
||||
import { readFileSync, writeFileSync, existsSync } from "fs";
|
||||
|
||||
export default async function VersionCheck() {
|
||||
const nowVersion: string = JSON.parse(fs.readFileSync("package.json", "utf-8")).version;
|
||||
const packageJson = JSON.parse(readFileSync("package.json", "utf-8"));
|
||||
|
||||
// 初期化
|
||||
if (!fs.existsSync("logs/version.txt")) {
|
||||
fs.writeFileSync(
|
||||
if (!existsSync("logs/version.txt")) {
|
||||
writeFileSync(
|
||||
"logs/version.txt",
|
||||
nowVersion,
|
||||
packageJson.version,
|
||||
"utf-8",
|
||||
);
|
||||
}
|
||||
|
||||
// 最終起動バージョン取得
|
||||
const oldVersion = fs.readFileSync("logs/version.txt", "utf-8");
|
||||
const oldVersion = readFileSync("logs/version.txt", "utf-8");
|
||||
|
||||
if (oldVersion !== nowVersion) {
|
||||
if (oldVersion !== packageJson.version) {
|
||||
try {
|
||||
fs.writeFileSync(
|
||||
writeFileSync(
|
||||
"logs/version.txt",
|
||||
nowVersion,
|
||||
packageJson.version,
|
||||
"utf-8",
|
||||
);
|
||||
|
||||
const releaseUrl = `${packageJson.repository.url}/releases/tag/${packageJson.tag}`;
|
||||
|
||||
await fetch(`https://${config.uwuzu.host}/api/ueuse/create`, {
|
||||
method: "POST",
|
||||
body: JSON.stringify({
|
||||
token: config.uwuzu.apiToken,
|
||||
text: `${nowVersion}にBOTがアップデートされました!`,
|
||||
text: `
|
||||
${packageJson.version}にBOTがアップデートされました!
|
||||
リリース内容:${releaseUrl}
|
||||
`,
|
||||
}),
|
||||
cache: "no-store",
|
||||
});
|
||||
} catch (err) {
|
||||
console.log("アップデート通知にエラーが発生しました: ", err);
|
||||
|
||||
Reference in New Issue
Block a user