diff --git a/.github/workflows/release-binary.yml b/.github/workflows/release-binary.yml new file mode 100644 index 0000000..4eec413 --- /dev/null +++ b/.github/workflows/release-binary.yml @@ -0,0 +1,37 @@ +name: Release binary in github release + +on: + push: + tags: + - "v*.*.*" + +env: + PROJECT_NAME: hacksquad-bot + +jobs: + build: + name: Build and publish the binary + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Install latest rust toolchain + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + default: true + override: true + + - name: Build the binary + run: | + cargo build --all --release + strip target/release/${{ env.PROJECT_NAME }} + mkdir publish/ + mv target/release/${{ env.PROJECT_NAME }} publish/${{ env.PROJECT_NAME }}_linux_amd64 + + - name: Release the binary + uses: ncipollo/release-action@v1 + with: + artifacts: "publish/*" + token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/docker.yml b/.github/workflows/release-docker.yml similarity index 98% rename from .github/workflows/docker.yml rename to .github/workflows/release-docker.yml index 5174ec7..5cb93c1 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/release-docker.yml @@ -2,7 +2,7 @@ name: Docker on: push: - branches: [ main ] + branches: [main] workflow_dispatch: env: diff --git a/src/events.rs b/src/events.rs index fb88ec0..0fc3da0 100644 --- a/src/events.rs +++ b/src/events.rs @@ -20,7 +20,20 @@ impl EventHandler for Handler { "hero" => commands::hero::hero(ctx, command.to_owned()).await, "randomhero" => commands::hero::random_hero(ctx, command.to_owned()).await, "info" => commands::info::run(ctx, command.to_owned()).await, - other_commands => println!("Unknown command {}", other_commands), + other_commands => { + if let Err(err) = command + .create_interaction_response(ctx.http, |response| { + response.interaction_response_data(|message| { + message.content("Unknown Command").ephemeral(true) + }) + }) + .await + { + println!("Error sending unknown command response: {:?}", err); + } + + println!("Unknown command {}", other_commands) + } }, Interaction::MessageComponent(ref component) => match component.message.interaction { Some(ref message_interaction) => match message_interaction.name.as_str() {