Skip to content

Commit

Permalink
chore: switch zephyrus to vesper, debug some discord things
Browse files Browse the repository at this point in the history
  • Loading branch information
Fyko committed Nov 1, 2023
1 parent d20c9f7 commit b2298d2
Show file tree
Hide file tree
Showing 20 changed files with 56 additions and 50 deletions.
62 changes: 32 additions & 30 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion chuckle-interactions/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down
2 changes: 1 addition & 1 deletion chuckle-interactions/src/commands/breakout_rooms.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};

Expand Down
Original file line number Diff line number Diff line change
@@ -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};

Expand Down
2 changes: 1 addition & 1 deletion chuckle-interactions/src/commands/config/default_org.rs
Original file line number Diff line number Diff line change
@@ -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};

Expand Down
2 changes: 1 addition & 1 deletion chuckle-interactions/src/commands/config/default_repo.rs
Original file line number Diff line number Diff line change
@@ -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};

Expand Down
2 changes: 1 addition & 1 deletion chuckle-interactions/src/commands/config/forum_log.rs
Original file line number Diff line number Diff line change
@@ -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};

Expand Down
2 changes: 1 addition & 1 deletion chuckle-interactions/src/commands/config/mod.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use chuckle_util::{db::get_settings, ChuckleState};
use zephyrus::prelude::*;
use vesper::prelude::*;

use super::{handle_generic_error, text_response};

Expand Down
2 changes: 1 addition & 1 deletion chuckle-interactions/src/commands/hexil.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};

Expand Down
2 changes: 1 addition & 1 deletion chuckle-interactions/src/commands/link_github.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use chuckle_util::ChuckleState;
use zephyrus::prelude::*;
use vesper::prelude::*;

use super::{handle_generic_error, text_response, user_from_interaction};

Expand Down
3 changes: 2 additions & 1 deletion chuckle-interactions/src/commands/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -29,6 +29,7 @@ pub fn user_from_interaction(interaction: &Interaction) -> User {

#[error_handler]
async fn handle_generic_error(ctx: &SlashContext<ChuckleState>, err: DefaultError) {
tracing::error!("Error handling command: {:#?}", err);
let _ = text_response(
ctx,
format!(
Expand Down
2 changes: 1 addition & 1 deletion chuckle-interactions/src/commands/ping.rs
Original file line number Diff line number Diff line change
@@ -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]
Expand Down
2 changes: 1 addition & 1 deletion chuckle-interactions/src/commands/pr_comments.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use chuckle_util::{db::get_settings, ChuckleState};
use zephyrus::prelude::*;
use vesper::prelude::*;

use super::{handle_generic_error, text_response};

Expand Down
2 changes: 1 addition & 1 deletion chuckle-interactions/src/commands/threads.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion chuckle-interactions/src/context_menu/circle_back.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};

Expand Down
2 changes: 1 addition & 1 deletion chuckle-interactions/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};

Expand Down
2 changes: 1 addition & 1 deletion chuckle-util/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down
2 changes: 1 addition & 1 deletion chuckle-util/src/chunkify.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use zephyrus::prelude::Parse;
use vesper::prelude::Parse;

#[derive(Parse, Debug)]
pub enum RemainderStrategy {
Expand Down
7 changes: 5 additions & 2 deletions chuckle-util/src/state.rs
Original file line number Diff line number Diff line change
@@ -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};
Expand All @@ -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<InteractionClient> {
Expand Down

0 comments on commit b2298d2

Please sign in to comment.