From 8a6f4b48a78586599ecbca1f31407e38272578ff Mon Sep 17 00:00:00 2001 From: shibedrill Date: Mon, 30 Sep 2024 16:15:01 -0400 Subject: [PATCH] Improved error handling again, add dependabot --- .github/dependabot.yml | 6 ++++++ .github/workflows/rust.yml | 2 ++ Cargo.lock | 6 +++--- Cargo.toml | 4 ++-- README.md | 11 ++++++++++- src/command/fun.rs | 7 ++++++- 6 files changed, 29 insertions(+), 7 deletions(-) create mode 100644 .github/dependabot.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..2c86e7f --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,6 @@ +version: 2 +updates: +- package-ecosystem: "cargo" + directory: "/" + schedule: + interval: "weekly" \ No newline at end of file diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 5ac3404..b72a7b5 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -27,6 +27,8 @@ jobs: steps: - uses: actions/checkout@v4 + - name: Check + run: cargo check - name: Build run: cargo build - name: Run tests diff --git a/Cargo.lock b/Cargo.lock index a303538..987a307 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1242,9 +1242,9 @@ dependencies = [ [[package]] name = "roux" -version = "2.2.12" +version = "2.2.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15948b57a15aed182d06fe3810eaf27dda15583c2f714437e1dd88fa12f33b82" +checksum = "0d306132b82946facd60ecf5505a2d6a8c69dd4b96b493bb16ff637987569028" dependencies = [ "maybe-async", "reqwest", @@ -1522,7 +1522,7 @@ dependencies = [ [[package]] name = "shibe-bot" -version = "0.2.4" +version = "0.2.5" dependencies = [ "build-time", "dotenv", diff --git a/Cargo.toml b/Cargo.toml index aabd1fd..d371a74 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "shibe-bot" -version = "0.2.4" +version = "0.2.5" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html @@ -14,6 +14,6 @@ tokio = { version = "1.0", features = ["macros", "rt-multi-thread"] } rand = "0.8.5" serde = { version = "1.0.198", features = ["serde_derive"] } serde_json = "1.0.116" -roux = "2.2.12" +roux = "2.2.13" rustc_version_runtime = "0.3.0" build-time = "0.1.3" diff --git a/README.md b/README.md index 1eedd53..e129f19 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,20 @@ -# Shibe Bot 0.2.4 +# Shibe Bot 0.2.5 + [![Rust](https://github.com/shibedrill/shibe-bot/actions/workflows/rust.yml/badge.svg)](https://github.com/shibedrill/shibe-bot/actions/workflows/rust.yml) [![GitHub License](https://img.shields.io/github/license/shibedrill/shibe-bot)](LICENSE.txt) + ## About Shibe Bot + Shibe Bot is a Discord bot written in Rust, using the Poise framework and the Serenity API crate. It has a few command groups right now, but none do anything especially useful. Commands are located at [src/command/](src/command/). + ## Licensing + Shibe Bot is available under the MIT license. See [LICENSE.txt](LICENSE.txt) for details. + ## Environment + The environment variable `TOKEN` must be set to the application's authentication token for the bot to run properly. + ## Contributing + Feel free to make PRs or feature requests. See [TODO.md](TODO.md) for future features. diff --git a/src/command/fun.rs b/src/command/fun.rs index b8521fe..779316d 100644 --- a/src/command/fun.rs +++ b/src/command/fun.rs @@ -35,7 +35,12 @@ pub async fn meow(ctx: Context<'_>) -> Result<(), Error> { true => "woof", // Will never return None. The source is statically defined. // We know it will always have items in it. - false => meows.choose(&mut rng).ok_or("`meows` array is empty")?, + false => meows + .choose(&mut rng) + .ok_or("`meows` array is empty") + .inspect_err(|e| { + error!("Executing command `meow` failed: {}", e); + })? } }; ctx.say(response).await?;