@friendlyrobot/discord-pi-agent 0.8.2 → 0.8.3
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/index.js +20 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -952,6 +952,24 @@ function isAuthorized(message, scope, authConfig) {
|
|
|
952
952
|
}
|
|
953
953
|
return false;
|
|
954
954
|
}
|
|
955
|
+
var WORKING_EMOJI = "⚙️";
|
|
956
|
+
async function addWorkingReaction(message) {
|
|
957
|
+
try {
|
|
958
|
+
await message.react(WORKING_EMOJI);
|
|
959
|
+
} catch (error) {
|
|
960
|
+
logger5.debug({ messageId: message.id, error }, "failed to add working reaction");
|
|
961
|
+
}
|
|
962
|
+
}
|
|
963
|
+
async function removeWorkingReaction(message) {
|
|
964
|
+
try {
|
|
965
|
+
const reaction = message.reactions.cache.get(WORKING_EMOJI);
|
|
966
|
+
if (reaction) {
|
|
967
|
+
await reaction.users.remove(message.client.user);
|
|
968
|
+
}
|
|
969
|
+
} catch (error) {
|
|
970
|
+
logger5.debug({ messageId: message.id, error }, "failed to remove working reaction");
|
|
971
|
+
}
|
|
972
|
+
}
|
|
955
973
|
var TYPING_INTERVAL_MS = 9000;
|
|
956
974
|
var typingIntervals = new Map;
|
|
957
975
|
function startTypingForChannel(channel, channelKey) {
|
|
@@ -1138,6 +1156,7 @@ async function onMessage(message, config, agentService, sessionRegistry, authCon
|
|
|
1138
1156
|
logger5.debug({ messageId: message.id }, "channel not sendable");
|
|
1139
1157
|
return;
|
|
1140
1158
|
}
|
|
1159
|
+
await addWorkingReaction(message);
|
|
1141
1160
|
const queuePosition = promptQueue.getSnapshot().pending;
|
|
1142
1161
|
logger5.debug({
|
|
1143
1162
|
scope,
|
|
@@ -1162,6 +1181,7 @@ async function onMessage(message, config, agentService, sessionRegistry, authCon
|
|
|
1162
1181
|
});
|
|
1163
1182
|
} finally {
|
|
1164
1183
|
stopTypingForChannel(channelKey);
|
|
1184
|
+
await removeWorkingReaction(message);
|
|
1165
1185
|
}
|
|
1166
1186
|
logger5.info({
|
|
1167
1187
|
direction: "OUT",
|