From: MatthieuCoder Date: Tue, 3 Jan 2023 10:56:36 +0000 (+0400) Subject: add ci X-Git-Tag: v0.1~24 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=f0cf9d95971b46f2219cbba2cf4dd7d52a606d88;p=matthieu%2Fnova.git add ci --- diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..110d266 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,61 @@ +name: Rust + +on: + push: + branches: + - main + pull_request: + +jobs: + lint: + name: Lint + runs-on: ubuntu-latest + steps: + - name: Setup | Checkout + uses: actions/checkout@v2 + - name: Setup | Rust + uses: ATiltedTree/setup-rust@v1 + with: + rust-version: stable + components: clippy + - name: Build | Lint + run: cargo clippy + compile: + name: Compile + runs-on: ubuntu-latest + steps: + - name: Setup | Checkout + uses: actions/checkout@v2 + - name: Install Protoc + uses: arduino/setup-protoc@v1 + - name: Setup | Rust + uses: ATiltedTree/setup-rust@v1 + with: + rust-version: stable + - name: Build | Compile + run: cargo check + test: + name: Test + strategy: + matrix: + os: + - ubuntu-latest + - windows-latest + - macOS-latest + rust: + - stable + - beta + - nightly + runs-on: ${{ matrix.os }} + needs: [compile] + steps: + - name: Setup | Checkout + uses: actions/checkout@v2 + - name: Install Protoc + uses: arduino/setup-protoc@v1 + - name: Setup | Rust + uses: ATiltedTree/setup-rust@v1 + with: + rust-version: ${{ matrix.rust }} + - name: Build | Compile + run: cargo test diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml deleted file mode 100644 index 31000a2..0000000 --- a/.github/workflows/rust.yml +++ /dev/null @@ -1,22 +0,0 @@ -name: Rust - -on: - push: - branches: [ "main" ] - pull_request: - branches: [ "main" ] - -env: - CARGO_TERM_COLOR: always - -jobs: - build: - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v3 - - name: Build - run: cargo build --verbose - - name: Run tests - run: cargo test --verbose diff --git a/exes/webhook/src/handler/handler.rs b/exes/webhook/src/handler/handler.rs index af79185..896e43f 100644 --- a/exes/webhook/src/handler/handler.rs +++ b/exes/webhook/src/handler/handler.rs @@ -84,7 +84,7 @@ impl WebhookService { match value.kind { InteractionType::Ping => Ok(Response::builder() .header("Content-Type", "application/json") - .body(r#"{"t":1}"#.into()) + .body(r#"{"type":1}"#.into()) .unwrap()), _ => { debug!("calling nats"); @@ -113,7 +113,7 @@ impl WebhookService { { Ok(response) => Ok(Response::builder() .header("Content-Type", "application/json") - .body(Body::from(response.reply.unwrap())) + .body(Body::from(response.payload)) .unwrap()), Err(error) => { @@ -156,8 +156,7 @@ impl Service> for WebhookService { } fn call(&mut self, req: Request) -> Self::Future { - let future = - Self::process_request(req, self.nats.clone(), self.config.discord.public_key); + let future = Self::process_request(req, self.nats.clone(), self.config.discord.public_key); Box::pin(async move { let response = future.await;