Skip to content

Commit

Permalink
chore: error handler for circle back
Browse files Browse the repository at this point in the history
  • Loading branch information
Fyko committed Sep 6, 2023
1 parent 0cf66a8 commit c8b6d77
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 21 deletions.
31 changes: 16 additions & 15 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,46 +1,47 @@
name: Tests
name: CI

env:
SQLX_OFFLINE: true
CARGO_TERM_COLOR: always

on:
push:
branches: [main]
paths-ignore: ["**.md"]
pull_request:
paths-ignore: ["**.md"]

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
check:
name: Lint, Format, and Build
name: Test Suite
runs-on: chortle
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Cache Cargo
uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: cargo-${{ runner.os }}-${{ hashFiles('**/Cargo.lock') }}

- name: Setup Problem Matchers
uses: r7kamura/rust-problem-matchers@v1

- run: rustup toolchain install stable --profile minimal

- name: Rust Cache
uses: Swatinem/rust-cache@v2

- name: Setup Rust
uses: dtolnay/rust-toolchain@stable

- name: Install Cargo Make
uses: davidB/rust-cargo-make@v1

- name: Run Formatter
run: cargo fmt --all --check
run: cargo make format

- name: Run Clippy
run: cargo clippy -- -D warnings
run: cargo make lint

- name: Build
run: cargo build --all-features --release
27 changes: 22 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,26 @@ repos:
- id: check-yaml
- id: check-added-large-files

- repo: https://github.com/doublify/pre-commit-rust
rev: v1.0
- repo: local
hooks:
- id: fmt
- id: cargo-check
- id: clippy
- id: format
name: format
description: Format files with cargo make fmt.
entry: cargo make format
language: system
types: [rust]
pass_filenames: false
- id: lint
name: lint
description: Lint files with cargo make lint.
entry: cargo make lint
language: system
types: [rust]
pass_filenames: false
- id: check
name: check
description: Check files with Cargo Check
entry: cargo check
language: system
types: [rust]
pass_filenames: false
3 changes: 2 additions & 1 deletion chuckle-interactions/src/context_menu/circle_back.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use time::{Duration, OffsetDateTime};
use twilight_model::application::interaction::InteractionData;
use zephyrus::prelude::*;

use crate::commands::{text_response, user_from_interaction};
use crate::commands::{handle_generic_error, text_response, user_from_interaction};

#[derive(Modal, Debug)]
#[modal(title = "Circle Back")]
Expand All @@ -21,6 +21,7 @@ struct CircleBackModal {
#[command(message, name = "Circle Back")]
#[description = "Circle back to this message in a given amount of time"]
#[only_guilds]
#[error_handler(handle_generic_error)]
pub async fn circle_back(ctx: &SlashContext<ChuckleState>) -> DefaultCommandResult {
let data = match &ctx.interaction.data {
Some(InteractionData::ApplicationCommand(data)) => data,
Expand Down

0 comments on commit c8b6d77

Please sign in to comment.