42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
async fn handle(update: telegram_bot::Update, core: &core::Core, mut _reply_to: &Option<telegram_bot::UserId>) -> Result<()> {
match update.kind {
telegram_bot::UpdateKind::Message(message) => {
match message.kind {
telegram_bot::MessageKind::Text { ref data, .. } => {
let sender = message.from.id;
let words: Vec<&str> = data.split_whitespace().collect();
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?,
_ => {
},
};
},
_ => {
},
};
},
_ => {},
|
|
|
|
|
|
|
|
>
>
|
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
async fn handle(update: telegram_bot::Update, core: &core::Core, mut _reply_to: &Option<telegram_bot::UserId>) -> Result<()> {
match update.kind {
telegram_bot::UpdateKind::Message(message) => {
match message.kind {
telegram_bot::MessageKind::Text { ref data, .. } => {
let sender = message.from.id;
let words: Vec<&str> = data.split_whitespace().collect();
match 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(()),
} {
Err(err) => core.send(&format!("🛑 {:?}", err), Some(sender), None)?,
Ok(()) => {},
};
},
_ => {
},
};
},
_ => {},
|