Overview
Comment: | make /list work again, more fixes |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
a7f91033c0168c03ac5daca37b2aa388 |
User & Date: | arcade on 2021-11-13 10:32:19.032 |
Other Links: | manifest | tags |
Context
2021-11-13
| ||
10:50 | 0.2.1: even more errors now can reach users check-in: 4632d20d39 user: arcade tags: trunk | |
10:32 | make /list work again, more fixes check-in: a7f91033c0 user: arcade tags: trunk | |
06:58 | 0.2.0: huge inner revamp, I guess now replies should be correctly sent to users. check-in: 9171c791eb user: arcade tags: trunk | |
Changes
Modified src/command.rs
from [99ad0c237b]
to [8e69210742].
1 2 3 4 5 6 7 8 9 10 11 12 13 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 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 | - + - + - + | use anyhow::{bail, Context, Result}; use crate::core::Core; use regex::Regex; use sedregex::ReplaceCommand; use telegram_bot; lazy_static! { static ref RE_USERNAME: Regex = Regex::new(r"^@[a-zA-Z][a-zA-Z0-9_]+$").unwrap(); static ref RE_LINK: Regex = Regex::new(r"^https?://[a-zA-Z.0-9-]+/[-_a-zA-Z.0-9/?=]+$").unwrap(); static ref RE_IV_HASH: Regex = Regex::new(r"^[a-f0-9]{14}$").unwrap(); } pub async fn start(core: &Core, sender: telegram_bot::UserId) -> Result<()> { |
︙ | |||
54 55 56 57 58 59 60 | 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 | - + - + - + | let mut i_command = command.into_iter(); let (channel, url, iv_hash, url_re) = ( i_command.next().context(at_least)?, i_command.next().context(at_least)?, i_command.next(), i_command.next()); if ! RE_USERNAME.is_match(&channel) { |
︙ | |||
88 89 90 91 92 93 94 | 88 89 90 91 92 93 94 95 96 97 | - + + | }; if admin.user.id == sender { user = true; }; }; if ! me { bail!("I need to be admin on that channel\\."); }; if ! user { bail!("You should be admin on that channel\\."); }; |
Modified src/core.rs
from [ad439a6329]
to [7064860d7e].
︙ | |||
46 47 48 49 50 51 52 | 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 | - + - + + + + + - + | .idle_timeout(std::time::Duration::new(60, 0)) .connect_lazy(&settings.get_str("pg")?)?, sources: Arc::new(Mutex::new(HashSet::new())), }; let clone = core.clone(); tokio::spawn(async move { if let Err(err) = &clone.autofetch().await { |
︙ | |||
318 319 320 321 322 323 324 | 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 | - + - + | //clone.owner_chat(UserId::new(owner)); let clone = Core { owner_chat: telegram_bot::UserId::new(owner), ..self.clone() }; tokio::spawn(async move { if let Err(err) = clone.check(&source_id, owner, true).await { |
︙ | |||
360 361 362 363 364 365 366 | 364 365 366 367 368 369 370 371 372 373 | - + | true => "🔄 enabled", false => "⛔ disabled", }, url)); if let Some(hash) = iv_hash { reply.push(format!("IV `{}`", hash)); } }; |
Modified src/main.rs
from [8ac82f2233]
to [2eed746c52].
1 2 3 4 5 6 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 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 | - - + - - + + - + - + - + - + - + | mod command; mod core; use config; use futures::StreamExt; use tokio; |
︙ |