mirror of
https://github.com/yoimiya-kokomi/miao-plugin.git
synced 2024-11-29 02:27:26 +00:00
add:#喵喵更新日志
Signed-off-by: 小花花花儿 <860563585bxy@gmail.com>
This commit is contained in:
parent
50b29402e6
commit
c5a749821c
@ -2,6 +2,8 @@ import fs from 'node:fs'
|
|||||||
import lodash from 'lodash'
|
import lodash from 'lodash'
|
||||||
import { exec } from 'child_process'
|
import { exec } from 'child_process'
|
||||||
import { Cfg, Common, Data, Version, App } from '#miao'
|
import { Cfg, Common, Data, Version, App } from '#miao'
|
||||||
|
import makemsg from "../../../lib/common/common.js"
|
||||||
|
import { execSync } from "child_process";
|
||||||
import fetch from 'node-fetch'
|
import fetch from 'node-fetch'
|
||||||
|
|
||||||
let keys = lodash.map(Cfg.getCfgSchemaMap(), (i) => i.key)
|
let keys = lodash.map(Cfg.getCfgSchemaMap(), (i) => i.key)
|
||||||
@ -24,6 +26,11 @@ app.reg({
|
|||||||
fn: updateMiaoPlugin,
|
fn: updateMiaoPlugin,
|
||||||
desc: '【#管理】喵喵更新'
|
desc: '【#管理】喵喵更新'
|
||||||
},
|
},
|
||||||
|
updatelog: {
|
||||||
|
rule: /^#?喵喵更新日志$/,
|
||||||
|
fn: Miaoupdatelog,
|
||||||
|
desc: '【#管理】喵喵更新'
|
||||||
|
},
|
||||||
sysCfg: {
|
sysCfg: {
|
||||||
rule: sysCfgReg,
|
rule: sysCfgReg,
|
||||||
fn: sysCfg,
|
fn: sysCfg,
|
||||||
@ -184,6 +191,35 @@ async function updateMiaoPlugin (e) {
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function Miaoupdatelog(e, plugin = 'miao-plugin') {
|
||||||
|
let cm = 'git log -20 --oneline --pretty=format:"%h||[%cd] %s" --date=format:"%F %T"'
|
||||||
|
if (plugin) {
|
||||||
|
cm = `cd ./plugins/${plugin}/ && ${cm}`
|
||||||
|
}
|
||||||
|
let logAll
|
||||||
|
try {
|
||||||
|
logAll = await execSync(cm, { encoding: 'utf-8', windowsHide: true })
|
||||||
|
} catch (error) {
|
||||||
|
logger.error(error.toString())
|
||||||
|
this.reply(error.toString())
|
||||||
|
}
|
||||||
|
if (!logAll) return false
|
||||||
|
logAll = logAll.split('\n')
|
||||||
|
let log = []
|
||||||
|
for (let str of logAll) {
|
||||||
|
str = str.split('||')
|
||||||
|
if (str[0] == this.oldCommitId) break
|
||||||
|
if (str[1].includes('Merge branch')) continue
|
||||||
|
log.push(str[1])
|
||||||
|
}
|
||||||
|
let line = log.length
|
||||||
|
log = log.join('\n\n')
|
||||||
|
if (log.length <= 0) return ''
|
||||||
|
let end = '更多详细信息,请前往gitee查看\nhttps://gitee.com/yoimiya-kokomi/miao-plugin'
|
||||||
|
log = await makemsg.makeForwardMsg(this.e, [log, end], `${plugin}更新日志,共${line}条`)
|
||||||
|
e.reply(log)
|
||||||
|
}
|
||||||
|
|
||||||
async function miaoApiInfo(e) {
|
async function miaoApiInfo(e) {
|
||||||
if (!await checkAuth(e)) {
|
if (!await checkAuth(e)) {
|
||||||
return true
|
return true
|
||||||
|
Loading…
Reference in New Issue
Block a user