41 lines
778 B
TypeScript
41 lines
778 B
TypeScript
import { plugin } from '#miao/core'
|
||
/**
|
||
*
|
||
*/
|
||
export class example2 extends plugin {
|
||
constructor () {
|
||
/**
|
||
name: '复读',
|
||
dsc: '复读用户发送的内容,然后撤回',
|
||
*/
|
||
super({
|
||
event: 'message',
|
||
priority: 5000,
|
||
rule: [
|
||
{
|
||
reg: '^#复读$',
|
||
fnc: 'repeat'
|
||
}
|
||
]
|
||
})
|
||
}
|
||
/**
|
||
*
|
||
*/
|
||
async repeat () {
|
||
/** 设置上下文,后续接收到内容会执行doRep方法 */
|
||
this.setContext('doRep')
|
||
/** 回复 */
|
||
await this.reply('请发送要复读的内容', false, { at: true })
|
||
}
|
||
/**
|
||
* 接受内容
|
||
*/
|
||
doRep () {
|
||
/** 复读内容 */
|
||
this.reply(this.e.message, false, { recallMsg: 5 })
|
||
/** 结束上下文 */
|
||
this.finish('doRep')
|
||
}
|
||
}
|