Skip to content

Commit

Permalink
Eliminate caching of inline results between chats
Browse files Browse the repository at this point in the history
  • Loading branch information
Leonid Kozarin committed Dec 5, 2023
1 parent 0ca6b59 commit b0013ce
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 12 deletions.
10 changes: 4 additions & 6 deletions src/handlers/inline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,12 +94,10 @@ pub async fn inline_handler(bot: Bot, query: InlineQuery, repos: Repositories) -
})
.collect();

let mut answer = bot.answer_inline_query(query.id, results)
.is_personal(true);
if cfg!(debug_assertions) {
answer.cache_time.replace(1);
}
answer.await?;
bot.answer_inline_query(query.id, results)
.is_personal(true)
.cache_time(1)
.await?;
Ok(())
}

Expand Down
10 changes: 4 additions & 6 deletions src/handlers/pvp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,12 +102,10 @@ pub async fn inline_handler(bot: Bot, query: InlineQuery) -> HandlerResult {
]]))
.into();

let mut answer = bot.answer_inline_query(query.id, vec![res])
.is_personal(true);
if cfg!(debug_assertions) {
answer.cache_time.replace(1);
}
answer.await?;
bot.answer_inline_query(query.id, vec![res])
.is_personal(true)
.cache_time(1)
.await?;
Ok(())
}

Expand Down

0 comments on commit b0013ce

Please sign in to comment.