Skip to content

Commit

Permalink
Merge pull request #72 from MiaowFISH/fix-execute
Browse files Browse the repository at this point in the history
[fix] 先修一下指令调用
  • Loading branch information
Touch-Night authored Dec 8, 2024
2 parents f64539f + 4ca2783 commit ae06f2d
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,8 @@ export function apply(ctx: Context, config: Config) {
msg = messages.join(',');
}

const commandResponseId = config.Debug.TestMode
? (await session.bot.sendMessage(msgDestination, msg, null, { session }))[0]
const commandResponseId = (msgDestination === session.channelId)
? (await session.sendQueued(msg))[0]
: (await session.bot.sendMessage(msgDestination, msg))[0];
sendQueue.clearQuietTimeout(msgDestination); // 发

Expand Down Expand Up @@ -608,8 +608,8 @@ ${handledRes.originalRes}`);
if (handledRes.execute) {
handledRes.execute.forEach(async (command) => {
try {
const botMessageId = config.Debug.TestMode
? (await session.bot.sendMessage(finalReplyTo, h("execute", {}, command), null, { session }))[0]
const botMessageId = (finalReplyTo === session.channelId)
? (await session.sendQueued(h("execute", {}, command)))[0]
: (await session.bot.sendMessage(finalReplyTo, h("execute", {}, command)))[0]; // 执行每个指令,获取返回的消息ID字符串数组
// sendQueue.clearQuietTimeout(finalReplyTo); // 发,但指令执行不需要清除静默期
if (config.Settings.AddWhattoQueue === "所有此插件发送和接收的消息" || config.Settings.AddWhattoQueue === "所有和LLM交互的消息") { // 虽然 LLM 使用的指令本身并不会发到消息界面,但为了防止 LLM 忘记自己用过指令,加入队列
Expand Down Expand Up @@ -653,8 +653,8 @@ ${handledRes.originalRes}`);
const waitTime = Math.ceil(sentence.length / config.Bot.WordsPerSecond);
await sleep(waitTime * 1000);
}
finalBotMsgId = config.Debug.TestMode
? (await session.bot.sendMessage(finalReplyTo, sentence, null, { session }))[0]
finalBotMsgId = (finalReplyTo === session.channelId)
? (await session.sendQueued(sentence))[0]
: (await session.bot.sendMessage(finalReplyTo, sentence))[0];
sendQueue.clearQuietTimeout(finalReplyTo); // 发
if (config.Settings.WholetoSplit && (config.Settings.AddWhattoQueue === "所有此插件发送和接收的消息" || config.Settings.AddWhattoQueue === "所有和LLM交互的消息")) {
Expand Down

0 comments on commit ae06f2d

Please sign in to comment.