Check-in [5a4aab7687]
Logged in as anonymous
Overview
Comment:fix error formatting
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | trunk | v0.4.3
Files: files | file ages | folders
SHA3-256: 5a4aab7687ee6334e372512e1950bbb6d5bfd46ed8ca8962b77836c9497847a7
User & Date: arcade on 2025-06-29 19:04:20.177
Other Links: manifest | tags
Context
2025-06-29
19:04
fix error formatting Leaf check-in: 5a4aab7687 user: arcade tags: trunk, v0.4.3
17:30
add more details on errors check-in: b4af85e31b user: arcade tags: trunk, v0.4.2
Changes
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
 "derive_builder",
 "never",
 "quick-xml",
]

[[package]]
name = "rsstg"
version = "0.4.2"
dependencies = [
 "anyhow",
 "async-std",
 "atom_syndication",
 "chrono",
 "config",
 "futures",







|







2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
 "derive_builder",
 "never",
 "quick-xml",
]

[[package]]
name = "rsstg"
version = "0.4.3"
dependencies = [
 "anyhow",
 "async-std",
 "atom_syndication",
 "chrono",
 "config",
 "futures",
1
2
3
4
5
6
7
8
9
10
[package]
name = "rsstg"
version = "0.4.2"
authors = ["arcade"]
edition = "2021"

[dependencies]
anyhow = "1.0.86"
async-std = { version = "1.12.0", features = [ "attributes", "tokio1" ] }
atom_syndication = { version = "0.12.4", features = [ "with-serde" ] }


|







1
2
3
4
5
6
7
8
9
10
[package]
name = "rsstg"
version = "0.4.3"
authors = ["arcade"]
edition = "2021"

[dependencies]
anyhow = "1.0.86"
async-std = { version = "1.12.0", features = [ "attributes", "tokio1" ] }
atom_syndication = { version = "0.12.4", features = [ "with-serde" ] }
18
19
20
21
22
23
24


25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40









41
42
43
44
45
46
47
use anyhow::{
	anyhow,
	bail,
	Result,
};
use async_std::task;
use chrono::DateTime;


use tgbot::{
	api::Client,
	handler::UpdateHandler,
	types::{
		Bot,
		ChatPeerId,
		Command,
		GetBot,
		Message,
		ParseMode,
		SendMessage,
		Update,
		UpdateType,
		UserPeerId,
	},
};










#[derive(Clone)]
pub struct Core {
	owner_chat: ChatPeerId,
	// max_delay: u16,
	pub tg: Client,
	pub me: Bot,







>
>
















>
>
>
>
>
>
>
>
>







18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
use anyhow::{
	anyhow,
	bail,
	Result,
};
use async_std::task;
use chrono::DateTime;
use lazy_static::lazy_static;
use regex::Regex;
use tgbot::{
	api::Client,
	handler::UpdateHandler,
	types::{
		Bot,
		ChatPeerId,
		Command,
		GetBot,
		Message,
		ParseMode,
		SendMessage,
		Update,
		UpdateType,
		UserPeerId,
	},
};

lazy_static!{
	pub static ref RE_SPECIAL: Regex = Regex::new(r"([\-_*\[\]()~`>#+|{}\.!])").unwrap();
}

/// Encodes special HTML entities to prevent them interfering with Telegram HTML
pub fn encode (text: &str) -> Cow<'_, str> {
	RE_SPECIAL.replace_all(text, "\\$1")
}

#[derive(Clone)]
pub struct Core {
	owner_chat: ChatPeerId,
	// max_delay: u16,
	pub tg: Client,
	pub me: Bot,
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
								Ok(Some(source)) => source.to_string(),
								Ok(None) => "Source not found in database?".to_string(),
								Err(err) => format!("Failed to fetch source data:\n{err}"),
							}
						};
						task::spawn(async move {
							if let Err(err) = clone.check(source_id, true).await {
								if let Err(err) = clone.send(&format!("{source}\nšŸ›‘ {err:?}"), None, None).await {
									eprintln!("Check error: {err:?}");
									// clone.disable(&source_id, owner).await.unwrap();
								};
							};
						});
					}
				} else if next_fetch - now < delay {







|







219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
								Ok(Some(source)) => source.to_string(),
								Ok(None) => "Source not found in database?".to_string(),
								Err(err) => format!("Failed to fetch source data:\n{err}"),
							}
						};
						task::spawn(async move {
							if let Err(err) = clone.check(source_id, true).await {
								if let Err(err) = clone.send(&format!("{source}\nšŸ›‘ {}", encode(&err.to_string())), None, Some(ParseMode::MarkdownV2)).await {
									eprintln!("Check error: {err:?}");
									// clone.disable(&source_id, owner).await.unwrap();
								};
							};
						});
					}
				} else if next_fetch - now < delay {