Explorar o código

Fixes glacier command (#580)

* Fixes glacier command
Mark Rousskov %!s(int64=4) %!d(string=hai) anos
pai
achega
2e93762e4b
Modificáronse 2 ficheiros con 3 adicións e 6 borrados
  1. 2 4
      parser/src/command/glacier.rs
  2. 1 2
      src/handlers/glacier.rs

+ 2 - 4
parser/src/command/glacier.rs

@@ -1,15 +1,13 @@
 //! The glacier command parser.
 //!
-//! This adds the option to track ICEs. Do note that the gist must be from a playground link.
-//! The link must also be in quotes.
+//! This adds the option to track ICEs. The <code-source> must be in quotes.
 //!
 //! The grammar is as follows:
 //!
 //! ```text
 //! Command: `@bot glacier <code-source>`
 //!
-//! <code-source>:
-//!   - "https://gist.github.com/.*"
+//! <code-source>: any URL that resolves to plain-text Rust code
 //! ```
 
 use crate::error::Error;

+ 1 - 2
src/handlers/glacier.rs

@@ -63,8 +63,7 @@ async fn handle_input(ctx: &Context, event: &Event, cmd: GlacierCommand) -> anyh
         return Ok(())
     };
 
-    let url = cmd.source;
-    let response = ctx.github.raw().get(&format!("{}{}", url.replace("github", "githubusercontent"), "/playground.rs")).send().await?;
+    let response = ctx.github.raw().get(&cmd.source).send().await?;
     let body = response.text().await?;
 
     let number = event.issue().unwrap().number;