Skip to content

Commit 6ac053a

Browse files
committed
use get_value
1 parent 5708bba commit 6ac053a

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

src/ephemeral.rs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ use std::num::ParseIntError;
6969
use std::str::FromStr;
7070
use std::time::{Duration, UNIX_EPOCH};
7171

72-
use anyhow::{ensure, Result};
72+
use anyhow::{ensure, Context as _, Result};
7373
use async_channel::Receiver;
7474
use serde::{Deserialize, Serialize};
7575
use tokio::time::timeout;
@@ -176,15 +176,12 @@ impl ChatId {
176176
pub async fn get_ephemeral_timer(self, context: &Context) -> Result<Timer> {
177177
let timer = context
178178
.sql
179-
.query_row(
179+
.query_get_value(
180180
"SELECT IFNULL(ephemeral_timer, 0) FROM chats WHERE id=?",
181181
(self,),
182-
|row| {
183-
let timer: Timer = row.get(0)?;
184-
Ok(timer)
185-
},
186182
)
187-
.await?;
183+
.await?
184+
.with_context(|| format!("Chat {self} not found"))?;
188185
Ok(timer)
189186
}
190187

0 commit comments

Comments
 (0)