61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
|
bail!("Usernames should be something like \"@\\[a\\-zA\\-Z]\\[a\\-zA\\-Z0\\-9\\_]+\", aren't they?\nNot {:?}", &channel);
};
if ! RE_LINK.is_match(&url) {
bail!("Link should be a link to atom/rss feed, something like \"https://domain/path\".\nNot {:?}", &url);
}
let iv_hash = match iv_hash {
Some(hash) => {
if ! RE_IV_HASH.is_match(hash) {
bail!("IV hash should be 14 hex digits.\nNot {:?}", hash);
};
match *hash {
"-" => None,
thing => Some(thing),
}
},
None => None,
};
let url_re = match url_re {
Some(re) => {
let _url_rex = ReplaceCommand::new(re).context("Regexp parsing error:")?;
match *re {
"-" => None,
thing => Some(thing),
}
},
None => None,
};
let channel_id = i64::from(core.tg.send(telegram_bot::GetChat::new(telegram_bot::types::ChatRef::ChannelUsername(channel.to_string()))).await?.id());
let chan_adm = core.tg.send(telegram_bot::GetChatAdministrators::new(telegram_bot::types::ChatRef::ChannelUsername(channel.to_string()))).await
.context("Sorry, I have no access to that chat.")?;
|
>
>
>
|
|
|
<
<
|
>
<
|
>
>
>
|
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
|
bail!("Usernames should be something like \"@\\[a\\-zA\\-Z]\\[a\\-zA\\-Z0\\-9\\_]+\", aren't they?\nNot {:?}", &channel);
};
if ! RE_LINK.is_match(&url) {
bail!("Link should be a link to atom/rss feed, something like \"https://domain/path\".\nNot {:?}", &url);
}
let iv_hash = match iv_hash {
Some(hash) => {
match *hash {
"-" => None,
thing => {
if ! RE_IV_HASH.is_match(thing) {
bail!("IV hash should be 14 hex digits.\nNot {:?}", thing);
};
Some(thing)
},
}
},
None => None,
};
let url_re = match url_re {
Some(re) => {
match *re {
"-" => None,
thing => {
let _url_rex = ReplaceCommand::new(thing).context("Regexp parsing error:")?;
Some(thing)
}
}
},
None => None,
};
let channel_id = i64::from(core.tg.send(telegram_bot::GetChat::new(telegram_bot::types::ChatRef::ChannelUsername(channel.to_string()))).await?.id());
let chan_adm = core.tg.send(telegram_bot::GetChatAdministrators::new(telegram_bot::types::ChatRef::ChannelUsername(channel.to_string()))).await
.context("Sorry, I have no access to that chat.")?;
|