@friendlyrobot/discord-pi-agent 0.19.11 → 0.19.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/discord-replies.d.ts +3 -1
- package/dist/index.js +9 -4
- package/package.json +1 -1
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import type { Message } from "discord.js";
|
|
2
2
|
export declare function addWorkingReaction(message: Message): Promise<void>;
|
|
3
3
|
export declare function removeWorkingReaction(message: Message): Promise<void>;
|
|
4
|
-
export declare function sendReply(message: Message, text: string
|
|
4
|
+
export declare function sendReply(message: Message, text: string, opts?: {
|
|
5
|
+
codeFence?: boolean;
|
|
6
|
+
}): Promise<void>;
|
package/dist/index.js
CHANGED
|
@@ -1140,7 +1140,7 @@ async function removeWorkingReaction(message) {
|
|
|
1140
1140
|
logger7.debug({ messageId: message.id, error }, "failed to remove working reaction");
|
|
1141
1141
|
}
|
|
1142
1142
|
}
|
|
1143
|
-
async function sendReply(message, text) {
|
|
1143
|
+
async function sendReply(message, text, opts) {
|
|
1144
1144
|
const channel = message.channel;
|
|
1145
1145
|
if (!channel.isSendable()) {
|
|
1146
1146
|
logger7.debug({
|
|
@@ -1148,7 +1148,10 @@ async function sendReply(message, text) {
|
|
|
1148
1148
|
}, "reply skipped, channel not sendable");
|
|
1149
1149
|
return;
|
|
1150
1150
|
}
|
|
1151
|
-
const
|
|
1151
|
+
const wrap = opts?.codeFence ? (c) => `\`\`\`
|
|
1152
|
+
${c}
|
|
1153
|
+
\`\`\`` : (c) => c;
|
|
1154
|
+
const chunks = chunkMessage(text).map(wrap);
|
|
1152
1155
|
const [firstChunk, ...remainingChunks] = chunks;
|
|
1153
1156
|
if (!firstChunk) {
|
|
1154
1157
|
return;
|
|
@@ -1538,7 +1541,9 @@ ${attachment.content}`;
|
|
|
1538
1541
|
logger11.info({ scope }, "archiving thread");
|
|
1539
1542
|
const archiveChannel = message.channel;
|
|
1540
1543
|
if (archiveChannel.isSendable()) {
|
|
1541
|
-
await archiveChannel.send(
|
|
1544
|
+
await archiveChannel.send(`\`\`\`
|
|
1545
|
+
${commandResult.response ?? "Archiving..."}
|
|
1546
|
+
\`\`\``);
|
|
1542
1547
|
}
|
|
1543
1548
|
try {
|
|
1544
1549
|
if (archiveChannel.isThread()) {
|
|
@@ -1556,7 +1561,7 @@ ${attachment.content}`;
|
|
|
1556
1561
|
hasResponse: Boolean(commandResult.response)
|
|
1557
1562
|
}, `command handled: ${content}`);
|
|
1558
1563
|
if (commandResult.response) {
|
|
1559
|
-
await sendReply(message, commandResult.response);
|
|
1564
|
+
await sendReply(message, commandResult.response, { codeFence: true });
|
|
1560
1565
|
}
|
|
1561
1566
|
return;
|
|
1562
1567
|
}
|