html terminal
Diffstat (limited to 'src/bot/js.rs')
-rw-r--r--src/bot/js.rs25
1 files changed, 1 insertions, 24 deletions
diff --git a/src/bot/js.rs b/src/bot/js.rs
index c882c77..fa7cbbe 100644
--- a/src/bot/js.rs
+++ b/src/bot/js.rs
@@ -1,5 +1,4 @@
use super::{return_next, send_ctx, Context, Result};
-use minify_js::{Session, TopLevelMode};
use regex::Regex;
use std::sync::LazyLock;
@@ -9,22 +8,7 @@ fn parse_js(from: &str) -> Result<String> {
let mat = RE
.captures(from)
.ok_or(anyhow::anyhow!(r#"no code found (use \`\`\`js...\`\`\`."#))?;
- let script = mat.get(2).unwrap().as_str();
- let mut out = vec![];
- Ok(
- if minify_js::minify(
- &Session::new(),
- TopLevelMode::Global,
- script.as_bytes(),
- &mut out,
- )
- .is_ok()
- {
- String::from_utf8_lossy(&out).to_string()
- } else {
- script.replace('\n', ";")
- },
- )
+ Ok(mat.get(2).unwrap().as_str().replace('\n', ";"))
}
#[poise::command(
@@ -47,10 +31,3 @@ pub async fn run(
send_ctx!(ctx, "js {script}")?;
return_next!(ctx)
}
-
-#[test]
-fn test_parse_js() {
- assert!(
- parse_js("```js\nLog.info(4)\nLog.info(4+2)\n```").unwrap() == "Log.info(4);Log.info(4+ 2)" // hmm
- )
-}