fix: this.reply
This commit is contained in:
parent
1750908350
commit
94b0df3b23
|
@ -33,7 +33,7 @@ export class status extends Plugin {
|
|||
if (this.e.isMaster) return this.statusMaster()
|
||||
|
||||
if (!this.e.isGroup) {
|
||||
this.reply('请群聊查看')
|
||||
this.e.reply('请群聊查看')
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -62,14 +62,14 @@ export class status extends Plugin {
|
|||
msg += '\n-------累计-------'
|
||||
msg += await this.getCount()
|
||||
|
||||
await this.reply(msg)
|
||||
await this.e.reply(msg)
|
||||
}
|
||||
|
||||
async statusGroup() {
|
||||
let msg = '-------状态-------'
|
||||
msg += await this.getCount(this.e.group_id)
|
||||
|
||||
await this.reply(msg)
|
||||
await this.e.reply(msg)
|
||||
}
|
||||
|
||||
async getCount(groupId:number | string = '') {
|
||||
|
|
|
@ -36,7 +36,7 @@ export class update extends Plugin {
|
|||
|
||||
async update() {
|
||||
if (!this.e.isMaster) return false
|
||||
if (uping) return this.reply('已有命令更新中..请勿重复操作')
|
||||
if (uping) return this.e.reply('已有命令更新中..请勿重复操作')
|
||||
|
||||
if (/详细|详情|面板|面版/.test(this.e.msg)) return false
|
||||
|
||||
|
@ -56,7 +56,7 @@ export class update extends Plugin {
|
|||
|
||||
/** 是否需要重启 */
|
||||
if (this.isUp) {
|
||||
// await this.reply('即将执行重启,以应用更新')
|
||||
// await this.e.reply('即将执行重启,以应用更新')
|
||||
setTimeout(() => this.restart(), 2000)
|
||||
}
|
||||
}
|
||||
|
@ -97,7 +97,7 @@ export class update extends Plugin {
|
|||
|
||||
logger.mark(`${this.e.logFnc} 开始${type}:${this.typeName}`)
|
||||
|
||||
await this.reply(`开始${type} ${this.typeName}`)
|
||||
await this.e.reply(`开始${type} ${this.typeName}`)
|
||||
uping = true
|
||||
const ret = await this.execSync(cm)
|
||||
uping = false
|
||||
|
@ -111,11 +111,11 @@ export class update extends Plugin {
|
|||
const time = await this.getTime(plugin)
|
||||
|
||||
if (/Already up|已经是最新/g.test(ret.stdout)) {
|
||||
await this.reply(`${this.typeName} 已是最新\n最后更新时间:${time}`)
|
||||
await this.e.reply(`${this.typeName} 已是最新\n最后更新时间:${time}`)
|
||||
} else {
|
||||
await this.reply(`${this.typeName} 更新成功\n更新时间:${time}`)
|
||||
await this.e.reply(`${this.typeName} 更新成功\n更新时间:${time}`)
|
||||
this.isUp = true
|
||||
await this.reply(await this.getLog(plugin))
|
||||
await this.e.reply(await this.getLog(plugin))
|
||||
}
|
||||
|
||||
logger.mark(`${this.e.logFnc} 最后更新时间:${time}`)
|
||||
|
@ -153,23 +153,23 @@ export class update extends Plugin {
|
|||
|
||||
if (errMsg.includes('Timed out')) {
|
||||
const remote = errMsg.match(/'(.+?)'/g)[0].replace(/'/g, '')
|
||||
return this.reply(`${msg}\n连接超时:${remote}`)
|
||||
return this.e.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}`)
|
||||
return this.e.reply(`${msg}\n连接失败:${remote}`)
|
||||
}
|
||||
|
||||
if (errMsg.includes('be overwritten by merge')) {
|
||||
return this.reply(`${msg}\n存在冲突:\n${errMsg}\n请解决冲突后再更新,或者执行#强制更新,放弃本地修改`)
|
||||
return this.e.reply(`${msg}\n存在冲突:\n${errMsg}\n请解决冲突后再更新,或者执行#强制更新,放弃本地修改`)
|
||||
}
|
||||
|
||||
if (stdout.includes('CONFLICT')) {
|
||||
return this.reply(`${msg}\n存在冲突:\n${errMsg}${stdout}\n请解决冲突后再更新,或者执行#强制更新,放弃本地修改`)
|
||||
return this.e.reply(`${msg}\n存在冲突:\n${errMsg}${stdout}\n请解决冲突后再更新,或者执行#强制更新,放弃本地修改`)
|
||||
}
|
||||
|
||||
return this.reply([errMsg, stdout])
|
||||
return this.e.reply([errMsg, stdout])
|
||||
}
|
||||
|
||||
async updateAll() {
|
||||
|
@ -182,7 +182,7 @@ export class update extends Plugin {
|
|||
|
||||
const testReg = /^#静默全部(强制)?更新$/.test(this.e.msg)
|
||||
if (testReg) {
|
||||
await this.reply(`开始执行静默全部更新,请稍等...`)
|
||||
await this.e.reply(`开始执行静默全部更新,请稍等...`)
|
||||
}
|
||||
|
||||
await this.runUpdate()
|
||||
|
@ -200,7 +200,7 @@ export class update extends Plugin {
|
|||
}
|
||||
|
||||
if (this.isUp) {
|
||||
// await this.reply('即将执行重启,以应用更新')
|
||||
// await this.e.reply('即将执行重启,以应用更新')
|
||||
setTimeout(() => this.restart(), 2000)
|
||||
}
|
||||
|
||||
|
@ -219,7 +219,7 @@ export class update extends Plugin {
|
|||
logAll = await execSync(cm, { encoding: 'utf-8' })
|
||||
} catch (error) {
|
||||
logger.error(error.toString())
|
||||
await this.reply(error.toString())
|
||||
await this.e.reply(error.toString())
|
||||
}
|
||||
|
||||
if (!logAll) return false
|
||||
|
@ -246,7 +246,7 @@ export class update extends Plugin {
|
|||
end = end.match(/remote\..*\.url=.+/g).join('\n\n').replace(/remote\..*\.url=/g, '').replace(/\/\/([^@]+)@/, '//')
|
||||
} catch (error) {
|
||||
logger.error(error.toString())
|
||||
await this.reply(error.toString())
|
||||
await this.e.reply(error.toString())
|
||||
}
|
||||
|
||||
return makeForwardMsg(this.e, [log, end], `${plugin || 'Miao-Yunzai'} 更新日志,共${line}条`)
|
||||
|
@ -255,6 +255,6 @@ export class update extends Plugin {
|
|||
async updateLog() {
|
||||
const plugin = this.getPlugin()
|
||||
if (plugin === false) return false
|
||||
return this.reply(await this.getLog(plugin))
|
||||
return this.e.reply(await this.getLog(plugin))
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
import { createRequire } from 'module'
|
||||
const require = createRequire(import.meta.url)
|
||||
const image: string = require('./resources/example.png')
|
||||
export const movies = [
|
||||
{
|
||||
id: 0,
|
||||
image: image,
|
||||
title: 'Prognosis Negative',
|
||||
starRating: '2.66',
|
||||
rating: 'PG-13',
|
||||
year: '2021',
|
||||
genre: 'Comedy',
|
||||
runtime: '1h 46m',
|
||||
cast: 'Simon Pegg, Zach Galifianakis '
|
||||
}
|
||||
]
|
32
image.tsx
32
image.tsx
|
@ -1,25 +1,13 @@
|
|||
import React from 'react'
|
||||
import { Component, Puppeteer } from 'yunzai/utils'
|
||||
import Hello, { PropsType } from './views/hello.tsx'
|
||||
// 初始化 组件渲染对象
|
||||
const Com = new Component()
|
||||
export class Image {
|
||||
Pup: typeof Puppeteer.prototype = null
|
||||
/**
|
||||
* 初始化运行Puppeteer
|
||||
*/
|
||||
import { Picture } from 'yunzai/utils'
|
||||
import { createDynamic } from 'yunzai/utils'
|
||||
import { PropsType } from './views/hello.tsx'
|
||||
const require = createDynamic(import.meta.url)
|
||||
export class Image extends Picture {
|
||||
constructor() {
|
||||
// init
|
||||
this.Pup = new Puppeteer()
|
||||
super()
|
||||
// start
|
||||
this.Pup.start()
|
||||
|
||||
this.Pup.setLaunch({
|
||||
defaultViewport: {
|
||||
width: 1280,
|
||||
height: 800
|
||||
}
|
||||
})
|
||||
}
|
||||
/**
|
||||
* 为指定用户生成html 生成指定数据下的html文件
|
||||
|
@ -27,14 +15,16 @@ export class Image {
|
|||
* @param Props 组件参数
|
||||
* @returns
|
||||
*/
|
||||
createHello(uid: number, Props: PropsType) {
|
||||
async createHello(uid: number, Props: PropsType) {
|
||||
// 此作用域可被重复执行,此处将变成动态组件 - 这是危险的!
|
||||
const Hello = (await require('./views/hello.tsx')).default;
|
||||
// 生成 html 地址 或 html字符串
|
||||
const Address = Com.create(<Hello {...Props} />, {
|
||||
const Address = this.Com.create(<Hello {...Props} />, {
|
||||
// html/hello/uid.html
|
||||
join_dir: 'hello',
|
||||
html_name: `${uid}.html`,
|
||||
})
|
||||
return this.Pup.render(Address,{
|
||||
return this.Pup.render(Address, {
|
||||
tab: ''
|
||||
})
|
||||
}
|
||||
|
|
23
routes.tsx
23
routes.tsx
|
@ -1,22 +1,9 @@
|
|||
import React from "react"
|
||||
import Hello from "./views/hello.tsx"
|
||||
import Music from './views/music.tsx'
|
||||
import { createRequire } from 'module'
|
||||
const require = createRequire(import.meta.url)
|
||||
const image: string = require('./resources/example.png')
|
||||
const movies = [
|
||||
{
|
||||
id: 0,
|
||||
image: image,
|
||||
title: 'Prognosis Negative',
|
||||
starRating: '2.66',
|
||||
rating: 'PG-13',
|
||||
year: '2021',
|
||||
genre: 'Comedy',
|
||||
runtime: '1h 46m',
|
||||
cast: 'Simon Pegg, Zach Galifianakis '
|
||||
}
|
||||
]
|
||||
import { movies } from "./data"
|
||||
import { createDynamic } from 'yunzai/utils'
|
||||
const require = createDynamic(import.meta.url)
|
||||
const Hello = (await require('./views/hello.tsx')).default;
|
||||
const Music = (await require('./views/music.tsx')).default;
|
||||
const Config = [
|
||||
{
|
||||
url: "/hello",
|
||||
|
|
Loading…
Reference in New Issue