Skip to content

Commit 98d8774

Browse files
author
梶塚太智
committed
Develop new command of send http request
1 parent 9912538 commit 98d8774

File tree

3 files changed

+15
-0
lines changed

3 files changed

+15
-0
lines changed

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@ edition = "2021"
88
[dependencies]
99
powershell_script = "1.1.0"
1010
rand = "0.8"
11+
reqwest = { version = "0.11.0", features = ["blocking"] }

examples/speaker.stk

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
(https://api.tts.quest/v3/voicevox/synthesis?text=)
2+
(文章を入力してください> ) input concat request
3+
(,) split 5 get (":") split 1 get (\) () replace
4+
(") () replace print

src/main.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -880,6 +880,16 @@ impl Executor {
880880
// 一定時間スリープ
881881
"sleep" => sleep(Duration::from_secs_f64(self.pop_stack().get_number())),
882882

883+
// Web系処理
884+
885+
//HTTPリクエストを送る
886+
"request" => {
887+
let url = self.pop_stack().get_string();
888+
self.stack.push(Type::String(
889+
reqwest::blocking::get(url).unwrap().text().unwrap(),
890+
));
891+
}
892+
883893
// コマンドとして認識されない場合は文字列とする
884894
_ => self.stack.push(Type::String(command)),
885895
}

0 commit comments

Comments
 (0)