diff options
| author | seth <[email protected]> | 2023-11-30 22:18:51 -0500 |
|---|---|---|
| committer | seth <[email protected]> | 2023-12-01 07:12:49 -0500 |
| commit | 76c0f94e6d7aa108424b34826eb7d8514b026287 (patch) | |
| tree | 7315bd6dfe52c158041bed64ba39781718a69335 /src/commands/copypasta.rs | |
| parent | db52e639b85d79bed870020aec7a045851ca5ee3 (diff) | |
feat: use eyre, better logging, & refactor
small commits be damned
Diffstat (limited to 'src/commands/copypasta.rs')
| -rw-r--r-- | src/commands/copypasta.rs | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/commands/copypasta.rs b/src/commands/copypasta.rs index 14a6673..313cd13 100644 --- a/src/commands/copypasta.rs +++ b/src/commands/copypasta.rs @@ -1,7 +1,8 @@ -use crate::{utils, Context, Error}; +use crate::{utils, Context}; use std::collections::HashMap; +use color_eyre::eyre::{eyre, Result}; use include_dir::{include_dir, Dir}; use log::*; @@ -58,8 +59,11 @@ fn get_copypasta(name: Copypastas) -> String { pub async fn copypasta( ctx: Context<'_>, #[description = "the copypasta you want to send"] copypasta: Copypastas, -) -> Result<(), Error> { - let gid = ctx.guild_id().unwrap_or_default(); +) -> Result<()> { + let gid = ctx + .guild_id() + .ok_or_else(|| eyre!("couldnt get guild from message!"))?; + if !utils::is_guild_allowed(gid) { info!("not running copypasta command in {gid}"); return Ok(()); |
