87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
|
// max_delay: 60,
};
let clone = core.clone();
task::spawn(async move {
loop {
let delay = match &clone.autofetch().await {
Err(err) => {
if let Err(err) = clone.send(format!("🛑 {err:?}"), None, None).await {
eprintln!("Autofetch error: {err:?}");
};
std::time::Duration::from_secs(60)
},
Ok(time) => *time,
};
task::sleep(delay).await;
|
|
|
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
|
// max_delay: 60,
};
let clone = core.clone();
task::spawn(async move {
loop {
let delay = match &clone.autofetch().await {
Err(err) => {
if let Err(err) = clone.send(format!("🛑 {err}"), None, None).await {
eprintln!("Autofetch error: {err:?}");
};
std::time::Duration::from_secs(60)
},
Ok(time) => *time,
};
task::sleep(delay).await;
|
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
|
for item in feed.entries() {
let date = item.published().unwrap();
let url = item.links()[0].href();
posts.insert(*date, url.to_string());
};
},
Err(err) => {
bail!("Unsupported or mangled content:\n{:?}\n{err:#?}\n{status:#?}\n", &source.url)
},
}
},
rss::Error::Eof => (),
_ => bail!("Unsupported or mangled content:\n{:?}\n{err:#?}\n{status:#?}\n", &source.url)
}
};
for (date, url) in posts.iter() {
let post_url: Cow<str> = match source.url_re {
Some(ref x) => sedregex::ReplaceCommand::new(x).stack()?.execute(url),
None => url.into(),
};
|
|
|
|
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
|
for item in feed.entries() {
let date = item.published().unwrap();
let url = item.links()[0].href();
posts.insert(*date, url.to_string());
};
},
Err(err) => {
bail!("Unsupported or mangled content:\n{:?}\n{err}\n{status:#?}\n", &source.url)
},
}
},
rss::Error::Eof => (),
_ => bail!("Unsupported or mangled content:\n{:?}\n{err}\n{status:#?}\n", &source.url)
}
};
for (date, url) in posts.iter() {
let post_url: Cow<str> = match source.url_re {
Some(ref x) => sedregex::ReplaceCommand::new(x).stack()?.execute(url),
None => url.into(),
};
|
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
|
"/check" | "/clean" | "/enable" | "/delete" | "/disable" => command::command(self, command, msg, words).await,
"/start" => command::start(self, msg).await,
"/list" => command::list(self, msg).await,
"/add" | "/update" => command::update(self, command, msg, words).await,
any => Err(anyhow!("Unknown command: {any}")),
};
if let Err(err) = res {
if let Err(err2) = self.send(format!("\\#error\n```\n{err:?}\n```"),
Some(msg.chat.get_id()),
Some(ParseMode::MarkdownV2)
).await{
dbg!(err2);
};
}
};
};
}
}
|
|
|
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
|
"/check" | "/clean" | "/enable" | "/delete" | "/disable" => command::command(self, command, msg, words).await,
"/start" => command::start(self, msg).await,
"/list" => command::list(self, msg).await,
"/add" | "/update" => command::update(self, command, msg, words).await,
any => Err(anyhow!("Unknown command: {any}")),
};
if let Err(err) = res {
if let Err(err2) = self.send(format!("\\#error\n```\n{err}\n```"),
Some(msg.chat.get_id()),
Some(ParseMode::MarkdownV2)
).await{
dbg!(err2);
};
}
};
};
}
}
|