Diff
Logged in as anonymous

Differences From Artifact [33a10a63f5]:

To Artifact [039d4ea389]:


1
2
3
4
5
6
7

8
9
10
11
12
13
14
15
mod command;
mod core;

use anyhow::Result;
use async_std::task;
use async_std::stream::StreamExt;


fn main() -> Result<()> {
	let settings = config::Config::builder()
		.add_source(config::File::with_name("rsstg"))
		.build()?;

	let core = core::Core::new(settings)?;

	let mut stream = core.stream();







>
|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
mod command;
mod core;

use anyhow::Result;
use async_std::task;
use async_std::stream::StreamExt;

#[async_std::main]
async fn main() -> Result<()> {
	let settings = config::Config::builder()
		.add_source(config::File::with_name("rsstg"))
		.build()?;

	let core = core::Core::new(settings)?;

	let mut stream = core.stream();
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
		}
	})
}

async fn handle(update: telegram_bot::Update, core: &core::Core, mut _reply_to: &Option<telegram_bot::UserId>) -> Result<()> {
	if let telegram_bot::UpdateKind::Message(message) = update.kind {
		if let Some(from) = message.from {
			if let telegram_bot::MessageKind::BotCommand { ref cmd_str, .. } = message.kind {
				let sender = from.id;
				let words: Vec<&str> = cmd_str.split_whitespace().collect();
				if let Err(err) = match words[0] {
					"/check" | "/clean" | "/enable" | "/delete" | "/disable" => command::command(core, sender, words).await,
					"/start" => command::start(core, sender).await,
					"/list" => command::list(core, sender).await,
					"/add" | "/update" => command::update(core, sender, words).await,
					_ => Ok(()),
				} {







|

|







33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
		}
	})
}

async fn handle(update: telegram_bot::Update, core: &core::Core, mut _reply_to: &Option<telegram_bot::UserId>) -> Result<()> {
	if let telegram_bot::UpdateKind::Message(message) = update.kind {
		if let Some(from) = message.from {
			if let telegram_bot::MessageKind::Text{ ref data, .. } = message.kind {
				let sender = from.id;
				let words: Vec<&str> = data.split_whitespace().collect();
				if let Err(err) = match words[0] {
					"/check" | "/clean" | "/enable" | "/delete" | "/disable" => command::command(core, sender, words).await,
					"/start" => command::start(core, sender).await,
					"/list" => command::list(core, sender).await,
					"/add" | "/update" => command::update(core, sender, words).await,
					_ => Ok(()),
				} {