{movie.title}
+-
+
- + Star rating + + +
- {movie.starRating} +
- Rating +
- {movie.rating} +
- Year +
- {movie.year} +
- Genre +
- + + {movie.genre} + +
- Runtime +
- + + {movie.runtime} + +
- Cast +
- {movie.cast} +
diff --git a/apps/add.ts b/apps/add.ts index d38909b..43f09f6 100644 --- a/apps/add.ts +++ b/apps/add.ts @@ -11,6 +11,9 @@ import { makeForwardMsg } from 'yunzai/core' const textArr = {} +/** + * tudo + */ export class add extends Plugin { path = './data/textJson/' facePath = './data/face/' diff --git a/apps/disFriPoke.ts b/apps/event/disFriPoke.ts similarity index 100% rename from apps/disFriPoke.ts rename to apps/event/disFriPoke.ts diff --git a/apps/disPri.ts b/apps/event/disPri.ts similarity index 100% rename from apps/disPri.ts rename to apps/event/disPri.ts diff --git a/apps/friend.ts b/apps/event/friend.ts similarity index 100% rename from apps/friend.ts rename to apps/event/friend.ts diff --git a/apps/invite.ts b/apps/event/invite.ts similarity index 88% rename from apps/invite.ts rename to apps/event/invite.ts index 6e1920e..5d78343 100644 --- a/apps/invite.ts +++ b/apps/event/invite.ts @@ -22,6 +22,11 @@ export class invite extends Plugin { * @returns */ async accept() { + if(/group/.test(this.event)){ + this.e.isGroup = true + } + if(!this.e.isGroup) return + // if (!cfg.masterQQ || !cfg.masterQQ.includes(String(this.e.user_id))) { logger.mark(`[邀请加群]:${this.e.group_name}:${this.e.group_id}`) return diff --git a/apps/newcomer.ts b/apps/event/newcomer.ts similarity index 100% rename from apps/newcomer.ts rename to apps/event/newcomer.ts diff --git a/apps/outNotice.ts b/apps/event/outNotice.ts similarity index 100% rename from apps/outNotice.ts rename to apps/event/outNotice.ts diff --git a/apps/quit.ts b/apps/event/quit.ts similarity index 100% rename from apps/quit.ts rename to apps/event/quit.ts diff --git a/apps/index.ts b/apps/index.ts index d02eb93..27a8015 100644 --- a/apps/index.ts +++ b/apps/index.ts @@ -4,15 +4,15 @@ * ***** */ export * from './add.js' -export * from './disFriPoke.js' -export * from './disPri.js' -export * from './friend.js' -export * from './invite.js' -export * from './quit.js' +export * from './event/disFriPoke.js' +export * from './event/disPri.js' +export * from './event/friend.js' +export * from './event/invite.js' +export * from './event/quit.js' export * from './restart.js' export * from './sendLog.js' export * from './status.js' export * from './update.js' export * from './example2.js' -export * from './newcomer.js' -export * from './outNotice.js' \ No newline at end of file +export * from './event/newcomer.js' +export * from './event/outNotice.js' \ No newline at end of file diff --git a/apps/restart.ts b/apps/restart.ts index 3356ce0..fa73e6f 100644 --- a/apps/restart.ts +++ b/apps/restart.ts @@ -5,6 +5,10 @@ import fs from 'fs' import YAML from 'yaml' import { exec } from 'child_process' +/** + * tudo + */ + /** * * @param port @@ -51,9 +55,9 @@ export class Restart extends Plugin { } async init() { - let restart = await redis.get(this.key) - if (restart) { - restart = JSON.parse(restart) + const data = await redis.get(this.key) + if (data) { + const restart = JSON.parse(data) const uin = restart?.uin || Bot.uin let time = restart.time || new Date().getTime() time = (new Date().getTime() - time) / 1000 diff --git a/apps/sendLog.ts b/apps/sendLog.ts index 95fa140..dbb9b16 100644 --- a/apps/sendLog.ts +++ b/apps/sendLog.ts @@ -4,6 +4,10 @@ import fs from "node:fs" import lodash from "lodash" import moment from "moment" +/** + * tudo + */ + /** * */ diff --git a/apps/status.ts b/apps/status.ts index 29dc30c..82dc968 100644 --- a/apps/status.ts +++ b/apps/status.ts @@ -2,6 +2,11 @@ import { ConfigController as cfg } from 'yunzai/config' import moment from 'moment' import { Plugin } from 'yunzai/core' + +/** + * tudo + */ + /** * */ diff --git a/apps/update.ts b/apps/update.ts index 3e154da..b46fad5 100644 --- a/apps/update.ts +++ b/apps/update.ts @@ -7,38 +7,52 @@ import { sleep } from 'yunzai/utils' import { exec, execSync } from 'child_process' import { BOT_NAME } from 'yunzai/config' +/** + * tudo + */ + let uping = false +const Cache = new Map() + +/** + * + */ export class update extends Plugin { typeName = BOT_NAME messages = [] + isUp = null + isNowUp = null + oldCommitId = null constructor() { - /** - name: '更新', - dsc: '#更新 #强制更新', - */ super() this.priority = 4000 this.rule = [ { - reg: '^#更新日志', + reg: /^#更新日志/, fnc: this.updateLog.name }, { - reg: '^#(强制)?更新', + reg: /^#(强制)?更新/, fnc: this.update.name }, { - reg: '^#(静默)?全部(强制)?更新$', + reg: /^#(静默)?全部(强制)?更新$/, fnc: this.updateAll.name, permission: 'master' } ] } - + /** + * + * @returns + */ async update() { if (!this.e.isMaster) return false - if (uping) return this.reply('已有命令更新中..请勿重复操作') + if (uping) { + this.reply('已有命令更新中..请勿重复操作') + return + } if (/详细|详情|面板|面版/.test(this.e.msg)) return false @@ -63,55 +77,60 @@ export class update extends Plugin { } } + /** + * + * @param Plugin + * @returns + */ getPlugin(Plugin = '') { if (!Plugin) { Plugin = this.e.msg.replace(/#(强制)?更新(日志)?/, '') if (!Plugin) return '' } - if (!fs.existsSync(`Plugins/${Plugin}/.git`)) return false - this.typeName = Plugin return Plugin } + /** + * + * @param cmd + * @returns + */ async execSync(cmd) { - return new Promise((resolve, reject) => { + return new Promise((resolve) => { exec(cmd, { windowsHide: true }, (error, stdout, stderr) => { resolve({ error, stdout, stderr }) }) }) } + /** + * + * @param Plugin + * @returns + */ async runUpdate(Plugin = '') { this.isNowUp = false - let cm = 'git pull --no-rebase' - let type = '更新' if (this.e.msg.includes('强制')) { type = '强制更新' cm = `git reset --hard && git pull --rebase --allow-unrelated-histories` } if (Plugin) cm = `cd "Plugins/${Plugin}" && ${cm}` - this.oldCommitId = await this.getcommitId(Plugin) - logger.mark(`${this.e.logFnc} 开始${type}:${this.typeName}`) - await this.reply(`开始${type} ${this.typeName}`) uping = true const ret = await this.execSync(cm) uping = false - if (ret.error) { logger.mark(`${this.e.logFnc} 更新失败:${this.typeName}`) this.gitErr(ret.error, ret.stdout) return false } - const time = await this.getTime(Plugin) - if (/Already up|已经是最新/g.test(ret.stdout)) { await this.reply(`${this.typeName} 已是最新\n最后更新时间:${time}`) } else { @@ -119,23 +138,30 @@ export class update extends Plugin { this.isUp = true await this.reply(await this.getLog(Plugin)) } - logger.mark(`${this.e.logFnc} 最后更新时间:${time}`) return true } + /** + * + * @param Plugin + * @returns + */ async getcommitId(Plugin = '') { let cm = 'git rev-parse --short HEAD' if (Plugin) cm = `cd "Plugins/${Plugin}" && ${cm}` - const commitId = await execSync(cm, { encoding: 'utf-8' }) return lodash.trim(commitId) } + /** + * + * @param Plugin + * @returns + */ async getTime(Plugin = '') { let cm = 'git log -1 --pretty=%cd --date=format:"%F %T"' if (Plugin) cm = `cd "Plugins/${Plugin}" && ${cm}` - let time = '' try { time = await execSync(cm, { encoding: 'utf-8' }) @@ -144,41 +170,42 @@ export class update extends Plugin { logger.error(error.toString()) time = '获取时间失败' } - return time } + /** + * + * @param err + * @param stdout + * @returns + */ async gitErr(err, stdout) { const msg = '更新失败!' const errMsg = err.toString() stdout = stdout.toString() - if (errMsg.includes('Timed out')) { const remote = errMsg.match(/'(.+?)'/g)[0].replace(/'/g, '') return this.reply(`${msg}\n连接超时:${remote}`) } - if (/Failed to connect|unable to access/g.test(errMsg)) { const remote = errMsg.match(/'(.+?)'/g)[0].replace(/'/g, '') return this.reply(`${msg}\n连接失败:${remote}`) } - if (errMsg.includes('be overwritten by merge')) { return this.reply(`${msg}\n存在冲突:\n${errMsg}\n请解决冲突后再更新,或者执行#强制更新,放弃本地修改`) } - if (stdout.includes('CONFLICT')) { return this.reply(`${msg}\n存在冲突:\n${errMsg}${stdout}\n请解决冲突后再更新,或者执行#强制更新,放弃本地修改`) } - return this.reply([errMsg, stdout]) } + /** + * + */ async updateAll() { const dirs = fs.readdirSync('./Plugins/') - const originalReply = this.reply - const testReg = /^#静默全部(强制)?更新$/.test(this.e.msg) if (testReg) { await this.reply(`开始执行静默全部更新,请稍等...`) @@ -208,10 +235,18 @@ export class update extends Plugin { this.reply = originalReply } + /** + * + */ restart() { new Restart(this.e).restart() } + /** + * + * @param Plugin + * @returns + */ async getLog(Plugin = '') { let cm = 'git log -100 --pretty="%h||[%cd] %s" --date=format:"%F %T"' if (Plugin) cm = `cd "Plugins/${Plugin}" && ${cm}` @@ -254,9 +289,14 @@ export class update extends Plugin { return makeForwardMsg(this.e, [log, end], `${Plugin || 'Miao-Yunzai'} 更新日志,共${line}条`) } + /** + * + * @returns + */ async updateLog() { const Plugin = this.getPlugin() if (Plugin === false) return false - return this.reply(await this.getLog(Plugin)) + this.reply(await this.getLog(Plugin)) + return } } diff --git a/component/List.tsx b/component/List.tsx new file mode 100644 index 0000000..983dba4 --- /dev/null +++ b/component/List.tsx @@ -0,0 +1,9 @@ +import React from "react"; + +export default function List({ children }) { + return ( +