fix bot reply skip
This commit is contained in:
@@ -517,6 +517,12 @@ async fn poll_once(
|
||||
new_items.reverse();
|
||||
|
||||
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!(
|
||||
"bot: processing notification from @{}: {}",
|
||||
notif.author_handle,
|
||||
@@ -568,10 +574,6 @@ async fn poll_once(
|
||||
{
|
||||
Ok(result) => {
|
||||
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) => {
|
||||
eprintln!("bot: reply failed for {}: {}", notif.uri, e);
|
||||
|
||||
@@ -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.
|
||||
- Keep posts short (under 300 characters).
|
||||
- Do NOT repeat or quote the user's message. Share your own perspective.
|
||||
- Call post_create only ONCE. Never call it twice.
|
||||
|
||||
Reference in New Issue
Block a user