Improved error handling again, add dependabot

This commit is contained in:
August 2024-09-30 16:15:01 -04:00
parent 30232c529e
commit 8a6f4b48a7
Signed by: shibedrill
GPG Key ID: 5FE0CB25945EFAA2
6 changed files with 29 additions and 7 deletions

6
.github/dependabot.yml vendored Normal file
View File

@ -0,0 +1,6 @@
version: 2
updates:
- package-ecosystem: "cargo"
directory: "/"
schedule:
interval: "weekly"

View File

@ -27,6 +27,8 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Check
run: cargo check
- name: Build
run: cargo build
- name: Run tests

6
Cargo.lock generated
View File

@ -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",

View File

@ -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"

View File

@ -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.

View File

@ -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?;