Heartbeat: normalize array replies
This commit is contained in:
@@ -310,11 +310,23 @@ export async function getReplyFromConfig(
|
||||
return result;
|
||||
}
|
||||
|
||||
if (reply && reply.mode === "command" && reply.command?.length) {
|
||||
const isHeartbeat = opts?.isHeartbeat === true;
|
||||
|
||||
if (reply && reply.mode === "command") {
|
||||
const commandArgs =
|
||||
isHeartbeat && reply.heartbeatCommand?.length
|
||||
? reply.heartbeatCommand
|
||||
: reply.command;
|
||||
|
||||
if (!commandArgs?.length) {
|
||||
cleanupTyping();
|
||||
return undefined;
|
||||
}
|
||||
|
||||
await onReplyStart();
|
||||
const commandReply = {
|
||||
...reply,
|
||||
command: reply.command,
|
||||
command: commandArgs,
|
||||
mode: "command" as const,
|
||||
};
|
||||
try {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
export type GetReplyOptions = {
|
||||
onReplyStart?: () => Promise<void> | void;
|
||||
isHeartbeat?: boolean;
|
||||
};
|
||||
|
||||
export type ReplyPayload = {
|
||||
|
||||
Reference in New Issue
Block a user