windsor-bot 0.2.7 → 0.2.8
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/bot.js +13 -6
- package/package.json +1 -1
package/dist/bot.js
CHANGED
|
@@ -211,12 +211,15 @@ export function createWindsorBot() {
|
|
|
211
211
|
const config = getReusableConfig(message);
|
|
212
212
|
if (!config)
|
|
213
213
|
return;
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
if (reusableStates.has(message.id))
|
|
214
|
+
const emoji = reaction.emoji.name ?? reaction.emoji.id ?? 'unknown';
|
|
215
|
+
logEvent('info', `Reusable reaction added: message=${message.id}, channel=${message.channelId}, emoji=${emoji}, user=${user.id}`);
|
|
216
|
+
if (reusableStates.has(message.id)) {
|
|
217
|
+
logEvent('info', `Ignoring reusable reaction for message=${message.id}; print already in progress`);
|
|
217
218
|
return;
|
|
219
|
+
}
|
|
218
220
|
const state = { reaction, cancelled: false, status: 'printing' };
|
|
219
221
|
reusableStates.set(message.id, state);
|
|
222
|
+
logEvent('info', `Starting reusable print for message=${message.id}`);
|
|
220
223
|
await handleReusablePrint(message, config, state);
|
|
221
224
|
}
|
|
222
225
|
catch (err) {
|
|
@@ -237,6 +240,10 @@ export function createWindsorBot() {
|
|
|
237
240
|
await removeReactionSafe(message, Reaction.waiting);
|
|
238
241
|
if (state.status !== 'printing')
|
|
239
242
|
reusableStates.delete(message.id);
|
|
243
|
+
logEvent('info', `Reusable reaction removed: message=${message.id}; cancelled ${state.status} print`);
|
|
244
|
+
}
|
|
245
|
+
else {
|
|
246
|
+
logEvent('info', `Reusable reaction removed: message=${message.id}; no active print`);
|
|
240
247
|
}
|
|
241
248
|
await removeOwnReactionSafe(reaction);
|
|
242
249
|
}
|
|
@@ -631,13 +638,13 @@ export function createWindsorBot() {
|
|
|
631
638
|
state.status = 'pending';
|
|
632
639
|
await reactSafe(message, Reaction.waiting);
|
|
633
640
|
enqueuePendingPrint(message, () => handleReusablePrint(message, config, state));
|
|
634
|
-
logEvent('info', `Printer unavailable for reusable message in #${message.channelId}`);
|
|
641
|
+
logEvent('info', `Printer unavailable for reusable message=${message.id} in #${message.channelId}; waiting for retry`);
|
|
635
642
|
return;
|
|
636
643
|
}
|
|
637
644
|
reusableStates.delete(message.id);
|
|
638
645
|
await removeReactionSafe(message, Reaction.waiting);
|
|
639
646
|
await replySafe(message, `⏸️ Print failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
640
|
-
logEvent('error', `Reusable List print failed: ${err}`);
|
|
647
|
+
logEvent('error', `Reusable List print failed: message=${message.id}: ${err}`);
|
|
641
648
|
return;
|
|
642
649
|
}
|
|
643
650
|
pendingPrints.delete(message.id);
|
|
@@ -648,7 +655,7 @@ export function createWindsorBot() {
|
|
|
648
655
|
}
|
|
649
656
|
await message.react(state.reaction.emoji);
|
|
650
657
|
state.status = 'printed';
|
|
651
|
-
logEvent('print', `Printed reusable message from ${message.author.username}`);
|
|
658
|
+
logEvent('print', `Printed reusable message=${message.id} from ${message.author.username}; acknowledgement reaction added`);
|
|
652
659
|
}
|
|
653
660
|
async function retryFailedMessages(message) {
|
|
654
661
|
const mapping = getCurrentConfig().channels.find(m => m.channelId === message.channelId);
|