From b2298d2a763807e6c796955901e463c2828e90c6 Mon Sep 17 00:00:00 2001 From: Carter Himmel Date: Wed, 1 Nov 2023 13:10:34 -0600 Subject: [PATCH] chore: switch zephyrus to vesper, debug some discord things --- Cargo.lock | 62 ++++++++++--------- Cargo.toml | 2 +- chuckle-interactions/Cargo.toml | 2 +- .../src/commands/breakout_rooms.rs | 2 +- .../src/commands/config/breakout_category.rs | 2 +- .../src/commands/config/default_org.rs | 2 +- .../src/commands/config/default_repo.rs | 2 +- .../src/commands/config/forum_log.rs | 2 +- .../src/commands/config/mod.rs | 2 +- chuckle-interactions/src/commands/hexil.rs | 2 +- .../src/commands/link_github.rs | 2 +- chuckle-interactions/src/commands/mod.rs | 3 +- chuckle-interactions/src/commands/ping.rs | 2 +- .../src/commands/pr_comments.rs | 2 +- chuckle-interactions/src/commands/threads.rs | 2 +- .../src/context_menu/circle_back.rs | 2 +- chuckle-interactions/src/lib.rs | 2 +- chuckle-util/Cargo.toml | 2 +- chuckle-util/src/chunkify.rs | 2 +- chuckle-util/src/state.rs | 7 ++- 20 files changed, 56 insertions(+), 50 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index fdf42c6..fc85be6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -344,7 +344,7 @@ dependencies = [ "twilight-model", "twilight-util", "uuid", - "zephyrus", + "vesper", ] [[package]] @@ -374,7 +374,7 @@ dependencies = [ "twilight-http", "twilight-model", "uuid", - "zephyrus", + "vesper", ] [[package]] @@ -2845,6 +2845,36 @@ version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" +[[package]] +name = "vesper" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6578b6c9fb8dfeb865767621df2153dab557f4f2183f3b85901720941e2d60e8" +dependencies = [ + "async-trait", + "parking_lot", + "thiserror", + "tokio", + "tracing", + "twilight-http", + "twilight-model", + "twilight-util", + "twilight-validate", + "vesper-macros", +] + +[[package]] +name = "vesper-macros" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e11caf0e4362ca72afdae15213f1016e9b7d5d6d964113babec1a0996a9aa3e4" +dependencies = [ + "darling", + "proc-macro2", + "quote", + "syn 2.0.25", +] + [[package]] name = "want" version = "0.3.0" @@ -3149,34 +3179,6 @@ dependencies = [ "linked-hash-map", ] -[[package]] -name = "zephyrus" -version = "0.10.0" -source = "git+https://github.com/AlvaroMS25/zephyrus?rev=3a68d762d058500bfcfa49a7cf9dbe850ed244e9#3a68d762d058500bfcfa49a7cf9dbe850ed244e9" -dependencies = [ - "async-trait", - "parking_lot", - "thiserror", - "tokio", - "tracing", - "twilight-http", - "twilight-model", - "twilight-util", - "twilight-validate", - "zephyrus-macros", -] - -[[package]] -name = "zephyrus-macros" -version = "0.10.0" -source = "git+https://github.com/AlvaroMS25/zephyrus?rev=3a68d762d058500bfcfa49a7cf9dbe850ed244e9#3a68d762d058500bfcfa49a7cf9dbe850ed244e9" -dependencies = [ - "darling", - "proc-macro2", - "quote", - "syn 2.0.25", -] - [[package]] name = "zeroize" version = "1.6.0" diff --git a/Cargo.toml b/Cargo.toml index d2abc39..67c6a82 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -50,7 +50,7 @@ twilight-http = { version = "0.15", default-features = false, features = ["rustl twilight-model = "0.15" twilight-util = { version = "0.15", features = ["builder"] } uuid = { version = "1", features = ["serde", "v4"] } -zephyrus = { git = "https://github.com/AlvaroMS25/zephyrus", rev = "3a68d762d058500bfcfa49a7cf9dbe850ed244e9", features = ["bulk"] } +vesper = { version = "0.11", features = ["bulk"] } [profile.dev.package.sqlx-macros] opt-level = 3 diff --git a/chuckle-interactions/Cargo.toml b/chuckle-interactions/Cargo.toml index 48bf9d0..24fc8a2 100644 --- a/chuckle-interactions/Cargo.toml +++ b/chuckle-interactions/Cargo.toml @@ -26,7 +26,7 @@ twilight-cache-inmemory = { workspace = true } twilight-model = { workspace = true } twilight-util = { workspace = true } uuid = { workspace = true } -zephyrus = { workspace = true } +vesper = { workspace = true } [features] default = ["lockfile"] diff --git a/chuckle-interactions/src/commands/breakout_rooms.rs b/chuckle-interactions/src/commands/breakout_rooms.rs index eb7d3b4..a83d93b 100644 --- a/chuckle-interactions/src/commands/breakout_rooms.rs +++ b/chuckle-interactions/src/commands/breakout_rooms.rs @@ -7,7 +7,7 @@ use chuckle_util::{ }; use rand::seq::SliceRandom; use twilight_model::{channel::Channel, id::Id}; -use zephyrus::{prelude::*, twilight_exports::ChannelMarker}; +use vesper::{prelude::*, twilight_exports::ChannelMarker}; use super::{edit_response, handle_generic_error, text_response}; diff --git a/chuckle-interactions/src/commands/config/breakout_category.rs b/chuckle-interactions/src/commands/config/breakout_category.rs index f008f68..adcd452 100644 --- a/chuckle-interactions/src/commands/config/breakout_category.rs +++ b/chuckle-interactions/src/commands/config/breakout_category.rs @@ -1,6 +1,6 @@ use chuckle_util::{db::get_settings, ChuckleState}; use twilight_model::id::{marker::ChannelMarker, Id}; -use zephyrus::prelude::*; +use vesper::prelude::*; use crate::commands::{handle_generic_error, text_response}; diff --git a/chuckle-interactions/src/commands/config/default_org.rs b/chuckle-interactions/src/commands/config/default_org.rs index cce3c62..42ddb99 100644 --- a/chuckle-interactions/src/commands/config/default_org.rs +++ b/chuckle-interactions/src/commands/config/default_org.rs @@ -1,5 +1,5 @@ use chuckle_util::{db::get_settings, ChuckleState}; -use zephyrus::prelude::*; +use vesper::prelude::*; use crate::commands::{handle_generic_error, text_response}; diff --git a/chuckle-interactions/src/commands/config/default_repo.rs b/chuckle-interactions/src/commands/config/default_repo.rs index d85a13c..e4ed5cc 100644 --- a/chuckle-interactions/src/commands/config/default_repo.rs +++ b/chuckle-interactions/src/commands/config/default_repo.rs @@ -1,5 +1,5 @@ use chuckle_util::{db::get_settings, ChuckleState}; -use zephyrus::prelude::*; +use vesper::prelude::*; use crate::commands::{handle_generic_error, text_response}; diff --git a/chuckle-interactions/src/commands/config/forum_log.rs b/chuckle-interactions/src/commands/config/forum_log.rs index 7a61405..f402847 100644 --- a/chuckle-interactions/src/commands/config/forum_log.rs +++ b/chuckle-interactions/src/commands/config/forum_log.rs @@ -1,6 +1,6 @@ use chuckle_util::{db::get_settings, ChuckleState}; use twilight_model::id::{marker::ChannelMarker, Id}; -use zephyrus::prelude::*; +use vesper::prelude::*; use crate::commands::{handle_generic_error, text_response}; diff --git a/chuckle-interactions/src/commands/config/mod.rs b/chuckle-interactions/src/commands/config/mod.rs index 7e73cc6..8dbdfe4 100644 --- a/chuckle-interactions/src/commands/config/mod.rs +++ b/chuckle-interactions/src/commands/config/mod.rs @@ -1,5 +1,5 @@ use chuckle_util::{db::get_settings, ChuckleState}; -use zephyrus::prelude::*; +use vesper::prelude::*; use super::{handle_generic_error, text_response}; diff --git a/chuckle-interactions/src/commands/hexil.rs b/chuckle-interactions/src/commands/hexil.rs index 8e05d64..194d4fb 100644 --- a/chuckle-interactions/src/commands/hexil.rs +++ b/chuckle-interactions/src/commands/hexil.rs @@ -4,7 +4,7 @@ use twilight_model::{ guild::Permissions, id::{marker::RoleMarker, Id}, }; -use zephyrus::prelude::*; +use vesper::prelude::*; use super::{handle_generic_error, text_response, user_from_interaction}; diff --git a/chuckle-interactions/src/commands/link_github.rs b/chuckle-interactions/src/commands/link_github.rs index 73736ee..26c7b64 100644 --- a/chuckle-interactions/src/commands/link_github.rs +++ b/chuckle-interactions/src/commands/link_github.rs @@ -1,5 +1,5 @@ use chuckle_util::ChuckleState; -use zephyrus::prelude::*; +use vesper::prelude::*; use super::{handle_generic_error, text_response, user_from_interaction}; diff --git a/chuckle-interactions/src/commands/mod.rs b/chuckle-interactions/src/commands/mod.rs index 94c6ea0..e87863d 100644 --- a/chuckle-interactions/src/commands/mod.rs +++ b/chuckle-interactions/src/commands/mod.rs @@ -5,7 +5,7 @@ use twilight_model::{ http::interaction::{InteractionResponse, InteractionResponseData, InteractionResponseType}, user::User, }; -use zephyrus::{framework::DefaultError, prelude::*}; +use vesper::{framework::DefaultError, prelude::*}; // groups pub mod breakout_rooms; @@ -29,6 +29,7 @@ pub fn user_from_interaction(interaction: &Interaction) -> User { #[error_handler] async fn handle_generic_error(ctx: &SlashContext, err: DefaultError) { + tracing::error!("Error handling command: {:#?}", err); let _ = text_response( ctx, format!( diff --git a/chuckle-interactions/src/commands/ping.rs b/chuckle-interactions/src/commands/ping.rs index aa14514..6dc25a5 100644 --- a/chuckle-interactions/src/commands/ping.rs +++ b/chuckle-interactions/src/commands/ping.rs @@ -1,6 +1,6 @@ use super::{handle_generic_error, text_response}; use chuckle_util::ChuckleState; -use zephyrus::prelude::*; +use vesper::prelude::*; #[tracing::instrument(skip(ctx))] #[command] diff --git a/chuckle-interactions/src/commands/pr_comments.rs b/chuckle-interactions/src/commands/pr_comments.rs index 4d140e7..b1585f9 100644 --- a/chuckle-interactions/src/commands/pr_comments.rs +++ b/chuckle-interactions/src/commands/pr_comments.rs @@ -1,5 +1,5 @@ use chuckle_util::{db::get_settings, ChuckleState}; -use zephyrus::prelude::*; +use vesper::prelude::*; use super::{handle_generic_error, text_response}; diff --git a/chuckle-interactions/src/commands/threads.rs b/chuckle-interactions/src/commands/threads.rs index 0082aea..afe25fd 100644 --- a/chuckle-interactions/src/commands/threads.rs +++ b/chuckle-interactions/src/commands/threads.rs @@ -3,7 +3,7 @@ use twilight_model::http::interaction::{ InteractionResponse, InteractionResponseData, InteractionResponseType, }; use twilight_model::{channel::message::AllowedMentions, id::Id}; -use zephyrus::{prelude::*, twilight_exports::RoleMarker}; +use vesper::{prelude::*, twilight_exports::RoleMarker}; use super::handle_generic_error; diff --git a/chuckle-interactions/src/context_menu/circle_back.rs b/chuckle-interactions/src/context_menu/circle_back.rs index f8c3e97..171dd6c 100644 --- a/chuckle-interactions/src/context_menu/circle_back.rs +++ b/chuckle-interactions/src/context_menu/circle_back.rs @@ -2,7 +2,7 @@ use chuckle_util::ChuckleState; use ms::*; use time::{Duration, OffsetDateTime}; use twilight_model::application::interaction::InteractionData; -use zephyrus::prelude::*; +use vesper::prelude::*; use crate::commands::{create_followup, handle_generic_error, user_from_interaction}; diff --git a/chuckle-interactions/src/lib.rs b/chuckle-interactions/src/lib.rs index a40924c..9dc7634 100644 --- a/chuckle-interactions/src/lib.rs +++ b/chuckle-interactions/src/lib.rs @@ -7,7 +7,7 @@ use chuckle_util::{ }; use twilight_model::id::marker::ApplicationMarker; use twilight_model::id::Id; -use zephyrus::prelude::Framework; +use vesper::prelude::Framework; use self::commands::{breakout_rooms, config, hexil, link_github, ping, pr_comments, threads}; diff --git a/chuckle-util/Cargo.toml b/chuckle-util/Cargo.toml index 9b074e8..140d569 100644 --- a/chuckle-util/Cargo.toml +++ b/chuckle-util/Cargo.toml @@ -11,7 +11,7 @@ homepage = { workspace = true } [dependencies] anyhow = { workspace = true } once_cell = { workspace = true } -zephyrus = { workspace = true } +vesper = { workspace = true } # config envy = { version = "0.4.2", optional = true } diff --git a/chuckle-util/src/chunkify.rs b/chuckle-util/src/chunkify.rs index e49f60a..4d03d10 100644 --- a/chuckle-util/src/chunkify.rs +++ b/chuckle-util/src/chunkify.rs @@ -1,4 +1,4 @@ -use zephyrus::prelude::Parse; +use vesper::prelude::Parse; #[derive(Parse, Debug)] pub enum RemainderStrategy { diff --git a/chuckle-util/src/state.rs b/chuckle-util/src/state.rs index 54dbd0f..647e228 100644 --- a/chuckle-util/src/state.rs +++ b/chuckle-util/src/state.rs @@ -1,7 +1,7 @@ use crate::CONFIG; use once_cell::sync::Lazy; -use std::str::FromStr; use std::sync::Arc; +use std::{str::FromStr, time::Duration}; use twilight_cache_inmemory::InMemoryCache; use twilight_http::client::InteractionClient; use twilight_model::id::{marker::ApplicationMarker, Id}; @@ -28,7 +28,10 @@ impl State { } pub fn http_client() -> twilight_http::Client { - twilight_http::Client::new(CONFIG.discord_token.clone()) + twilight_http::Client::builder() + .token(CONFIG.discord_token.clone()) + .timeout(Duration::from_secs(10)) + .build() } pub fn interactions_client(&self) -> Arc {