Commit Diff


commit - 0c3b2b06aa7fc21f835949c10db08e5dd0f1343a
commit + c2a2eaa25bad5582da022cdbcd60c3c3b05755bc
blob - 08c12ed913f84a1e8e24eb02efe943b99112a2ce
blob + 3476063df482d14bdadcc405b721c1d72046bb09
--- Cargo.lock
+++ Cargo.lock
@@ -1,5 +1,7 @@
 # This file is automatically @generated by Cargo.
 # It is not intended for manual editing.
+version = 3
+
 [[package]]
 name = "adler"
 version = "1.0.2"
@@ -7,15 +9,6 @@ source = "registry+https://github.com/rust-lang/crates
 checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe"
 
 [[package]]
-name = "ansi_term"
-version = "0.11.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b"
-dependencies = [
- "winapi",
-]
-
-[[package]]
 name = "async-trait"
 version = "0.1.50"
 source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -43,17 +36,6 @@ dependencies = [
 ]
 
 [[package]]
-name = "atty"
-version = "0.2.14"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8"
-dependencies = [
- "hermit-abi",
- "libc",
- "winapi",
-]
-
-[[package]]
 name = "autocfg"
 version = "1.0.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -137,21 +119,6 @@ dependencies = [
 ]
 
 [[package]]
-name = "clap"
-version = "2.33.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "37e58ac78573c40708d45522f0d80fa2f01cc4f9b4e2bf749807255454312002"
-dependencies = [
- "ansi_term",
- "atty",
- "bitflags",
- "strsim",
- "textwrap",
- "unicode-width",
- "vec_map",
-]
-
-[[package]]
 name = "command_attr"
 version = "0.3.6"
 source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -506,7 +473,7 @@ dependencies = [
 name = "incidence_updates"
 version = "0.1.0"
 dependencies = [
- "clap",
+ "openssl",
  "reqwest",
  "serde",
  "serde_json",
@@ -724,6 +691,15 @@ source = "registry+https://github.com/rust-lang/crates
 checksum = "28988d872ab76095a6e6ac88d99b54fd267702734fd7ffe610ca27f533ddb95a"
 
 [[package]]
+name = "openssl-src"
+version = "111.15.0+1.1.1k"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b1a5f6ae2ac04393b217ea9f700cd04fa9bf3d93fae2872069f3d15d908af70a"
+dependencies = [
+ "cc",
+]
+
+[[package]]
 name = "openssl-sys"
 version = "0.9.63"
 source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -732,6 +708,7 @@ dependencies = [
  "autocfg",
  "cc",
  "libc",
+ "openssl-src",
  "pkg-config",
  "vcpkg",
 ]
@@ -1144,12 +1121,6 @@ source = "registry+https://github.com/rust-lang/crates
 checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f"
 
 [[package]]
-name = "strsim"
-version = "0.8.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a"
-
-[[package]]
 name = "syn"
 version = "1.0.72"
 source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -1175,15 +1146,6 @@ dependencies = [
 ]
 
 [[package]]
-name = "textwrap"
-version = "0.11.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060"
-dependencies = [
- "unicode-width",
-]
-
-[[package]]
 name = "time"
 version = "0.1.43"
 source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -1374,12 +1336,6 @@ dependencies = [
 ]
 
 [[package]]
-name = "unicode-width"
-version = "0.1.8"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9337591893a19b88d8d87f2cec1e73fad5cdfd10e5a6f349f498ad6ea2ffb1e3"
-
-[[package]]
 name = "unicode-xid"
 version = "0.2.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -1422,12 +1378,6 @@ source = "registry+https://github.com/rust-lang/crates
 checksum = "025ce40a007e1907e58d5bc1a594def78e5573bb0b1160bc389634e8f12e4faa"
 
 [[package]]
-name = "vec_map"
-version = "0.8.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191"
-
-[[package]]
 name = "version_check"
 version = "0.9.3"
 source = "registry+https://github.com/rust-lang/crates.io-index"
blob - 04a6b3f493a1094e3e44c63ea6a085755a362d81
blob + a0eaa0d2a9bbe6663c9b375617215f83e8b534a1
--- Cargo.toml
+++ Cargo.toml
@@ -12,3 +12,4 @@ serenity = { version = "0.10", default-features = true
 serde = { version = "1.0", features = ["derive"] }
 serde_json = "1.0"
 reqwest = { version = "0.11", features = ["json"] }
+openssl = { version = "0.10.32", features = ["vendored"] }
blob - 0b91b6c1c4060185b892209d35305d75a23d5094
blob + dd05b75b631b9e44020bd70b33e9f10903eaadf6
--- src/main.rs
+++ src/main.rs
@@ -14,11 +14,8 @@ async fn main() {
     let token = env::var("DISCORD_TOKEN").expect("Missing DISCORD_TOKEN environment variable");
     let channel_id = env::var("CHANNEL_ID").expect("Missing CHANNEL_ID environment variable");
     let districts_env = env::var("DISTRICTS").expect("Missing DISTRICTS environment variable");
-    let districts = &districts_env.split(",").collect::<Vec<&str>>().iter().map(|s| s.to_string()).collect::<Vec<String>>();
+    let districts: Vec<String> = districts_env.split(",").map(|s| s.to_string()).collect();
 
-    let http = Http::new_with_token(&token);
-    let cid = ChannelId(channel_id.parse::<u64>().expect("CHANNEL_ID not an unsigned integer"));
-    //let districts = vec![String::from("08435"), String::from("08317"), String::from("11009")];
     let msg = match api_query::get_all_district_info(&districts).await {
         Ok(k) => {
             let mut s = String::from("```\n");
@@ -29,10 +26,12 @@ async fn main() {
         },
         Err(e) => {
             println!("{:?}", e);
-            String::from(e)
+            std::process::exit(1);
         },
     };
 
+    let http = Http::new_with_token(&token);
+    let cid = ChannelId(channel_id.parse::<u64>().expect("CHANNEL_ID not an unsigned integer"));
     match cid.send_message(&http, |m| m.content(msg)).await {
         Ok(_) => {
         },