2
0

fix bot reply skip

This commit is contained in:
2026-03-23 07:49:16 +09:00
parent e3865dbfa0
commit a55e4eced1
2 changed files with 7 additions and 4 deletions

View File

@@ -517,6 +517,12 @@ async fn poll_once(
new_items.reverse(); new_items.reverse();
for notif in &new_items { for notif in &new_items {
// Mark as processed immediately to prevent duplicate replies
state.processed.insert(notif.uri.clone());
if let Err(e) = save_state(state) {
eprintln!("bot: failed to save state: {}", e);
}
eprintln!( eprintln!(
"bot: processing notification from @{}: {}", "bot: processing notification from @{}: {}",
notif.author_handle, notif.author_handle,
@@ -568,10 +574,6 @@ async fn poll_once(
{ {
Ok(result) => { Ok(result) => {
eprintln!("bot: replied -> {}", result.uri); eprintln!("bot: replied -> {}", result.uri);
state.processed.insert(notif.uri.clone());
if let Err(e) = save_state(state) {
eprintln!("bot: failed to save state: {}", e);
}
} }
Err(e) => { Err(e) => {
eprintln!("bot: reply failed for {}: {}", notif.uri, e); eprintln!("bot: reply failed for {}: {}", notif.uri, e);

View File

@@ -37,3 +37,4 @@ After replying to a conversation, you may post your own thoughts using the `post
- Stay in character. The post should sound like you, not a summary. - Stay in character. The post should sound like you, not a summary.
- Keep posts short (under 300 characters). - Keep posts short (under 300 characters).
- Do NOT repeat or quote the user's message. Share your own perspective. - Do NOT repeat or quote the user's message. Share your own perspective.
- Call post_create only ONCE. Never call it twice.