Преглед изворни кода

Triagebot learned the `read` cmd

Meeting attendees are invited to read a document and notify when they
start and when they finish reading the document.

Closes #1613
apiraino пре 2 година
родитељ
комит
287aacbb84
1 измењених фајлова са 14 додато и 0 уклоњено
  1. 14 0
      src/zulip.rs

+ 14 - 0
src/zulip.rs

@@ -181,6 +181,13 @@ fn handle_command<'a>(
                                 })
                                 .unwrap(),
                             },
+                            Some("read") => return match post_waiter(&ctx, message_data, WaitingMessage::start_reading()).await {
+                                Ok(r) => r,
+                                Err(e) => serde_json::to_string(&Response {
+                                    content: &format!("Failed to await at this time: {:?}", e),
+                                })
+                                .unwrap(),
+                            },
                             _ => {}
                         }
                     }
@@ -749,6 +756,13 @@ impl WaitingMessage<'static> {
             emoji: &["working_on_it", "all_good"],
         }
     }
+    fn start_reading() -> Self {
+        WaitingMessage {
+            primary: "Click on the :book: when you start reading (and leave it clicked).\n\
+                      Click on the :checkered_flag: when you finish reading.",
+            emoji: &["book", "checkered_flag"],
+        }
+    }
 }
 
 async fn post_waiter(