mirror of
https://github.com/LLOneBot/LLOneBot.git
synced 2024-11-22 01:56:33 +00:00
fix
This commit is contained in:
parent
3f4b0b44cf
commit
d143dc043c
@ -52,7 +52,7 @@ export class ConfigUtil {
|
||||
autoDeleteFile: false,
|
||||
autoDeleteFileSecond: 60,
|
||||
musicSignUrl: '',
|
||||
msgCacheExpire: 8000
|
||||
msgCacheExpire: 120
|
||||
}
|
||||
|
||||
if (!fs.existsSync(this.configPath)) {
|
||||
|
@ -134,9 +134,12 @@ export function getSelfUin() {
|
||||
const messages: Map<string, RawMessage> = new Map()
|
||||
let expire: number
|
||||
|
||||
/** 缓存已撤回消息内容 */
|
||||
export function addMsgCache(msg: RawMessage) {
|
||||
expire ??= getConfigUtil().getConfig().msgCacheExpire!
|
||||
/** 缓存近期消息内容 */
|
||||
export async function addMsgCache(msg: RawMessage) {
|
||||
expire ??= getConfigUtil().getConfig().msgCacheExpire! * 1000
|
||||
if (expire === 0) {
|
||||
return
|
||||
}
|
||||
const id = msg.msgId
|
||||
messages.set(id, msg)
|
||||
setTimeout(() => {
|
||||
@ -144,7 +147,7 @@ export function addMsgCache(msg: RawMessage) {
|
||||
}, expire)
|
||||
}
|
||||
|
||||
/** 获取已撤回消息内容 */
|
||||
/** 获取近期消息内容 */
|
||||
export function getMsgCache(msgId: string) {
|
||||
return messages.get(msgId)
|
||||
}
|
@ -30,6 +30,7 @@ export interface Config {
|
||||
ffmpeg?: string // ffmpeg路径
|
||||
musicSignUrl?: string
|
||||
ignoreBeforeLoginMsg?: boolean
|
||||
/** 单位为秒 */
|
||||
msgCacheExpire?: number
|
||||
}
|
||||
|
||||
|
@ -96,7 +96,7 @@ function onLoad() {
|
||||
}
|
||||
ipcMain.handle(CHANNEL_ERROR, async (event, arg) => {
|
||||
const ffmpegOk = await checkFfmpeg(getConfigUtil().getConfig().ffmpeg)
|
||||
llonebotError.ffmpegError = ffmpegOk ? '' : '没有找到ffmpeg,音频只能发送wav和silk,视频尺寸可能异常'
|
||||
llonebotError.ffmpegError = ffmpegOk ? '' : '没有找到 FFmpeg, 音频只能发送 WAV 和 SILK, 视频尺寸可能异常'
|
||||
let { httpServerError, wsServerError, otherError, ffmpegError } = llonebotError
|
||||
let error = `${otherError}\n${httpServerError}\n${wsServerError}\n${ffmpegError}`
|
||||
error = error.replace('\n\n', '\n')
|
||||
@ -160,6 +160,7 @@ function onLoad() {
|
||||
peerUid: message.peerUid
|
||||
}
|
||||
message.msgShortId = MessageUnique.createMsg(peer, message.msgId)
|
||||
addMsgCache(message)
|
||||
|
||||
OB11Constructor.message(message)
|
||||
.then((msg) => {
|
||||
@ -184,7 +185,7 @@ function onLoad() {
|
||||
}
|
||||
})
|
||||
OB11Constructor.PrivateEvent(message).then((privateEvent) => {
|
||||
log(message)
|
||||
//log(message)
|
||||
if (privateEvent) {
|
||||
// log("post private event", privateEvent);
|
||||
postOb11Event(privateEvent)
|
||||
@ -223,7 +224,6 @@ function onLoad() {
|
||||
if (!oriMessageId) {
|
||||
continue
|
||||
}
|
||||
addMsgCache(message)
|
||||
OB11Constructor.RecallEvent(message, oriMessageId).then((recallEvent) => {
|
||||
if (recallEvent) {
|
||||
//log('post recall event', recallEvent)
|
||||
|
@ -220,8 +220,8 @@ async function onSettingWindowCreated(view: Element) {
|
||||
SettingButton('打开', 'config-open-log-path'),
|
||||
),
|
||||
SettingItem(
|
||||
'已撤回消息内容缓存时长',
|
||||
'单位为毫秒',
|
||||
'消息内容缓存时长',
|
||||
'单位为秒',
|
||||
`<div class="q-input"><input class="q-input__inner" data-config-key="msgCacheExpire" type="number" min="1" value="${config.msgCacheExpire}" placeholder="${config.msgCacheExpire}" /></div>`,
|
||||
),
|
||||
]),
|
||||
|
Loading…
x
Reference in New Issue
Block a user