Skip to content

Commit

Permalink
chore: update serenity (#48)
Browse files Browse the repository at this point in the history
* chore: update serenity

* fix: make clippy happy
  • Loading branch information
CalliEve authored Jan 7, 2024
1 parent 824e178 commit 71575d1
Show file tree
Hide file tree
Showing 27 changed files with 1,126 additions and 1,164 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ version = "0.1.0"
rustflags = ["--cfg", "tokio_unstable"]

[dependencies]
serenity = {version="0.11.5", features=["unstable_discord_api"]}
serenity = {version="0.12.0"}
lazy_static = "1.4"
reqwest = { version = "0.11", features = ["json"] }
serde = { version = "1.0", features = ["derive"] }
Expand Down
2 changes: 1 addition & 1 deletion okto_framework/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ version = "0.1.0"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
serde_repr = "0.1"
serenity = {version="^0.11.6"}
serenity = {version="^0.12.0"}
futures = "0.3"
paste = "1.0"
6 changes: 3 additions & 3 deletions okto_framework/src/handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use serenity::{
client::Context,
framework::standard::CommandResult,
http::Http,
model::application::interaction::Interaction,
model::application::Interaction,
Result,
};

Expand Down Expand Up @@ -72,7 +72,7 @@ impl Handler {
ctx: &Context,
interaction: &Interaction,
) -> CommandResult {
if let Interaction::ApplicationCommand(cmd_interaction) = interaction {
if let Interaction::Command(cmd_interaction) = interaction {
if let Some(cmd) = self
.cmds
.get(
Expand Down Expand Up @@ -102,7 +102,7 @@ impl Handler {
)?;

http.as_ref()
.create_global_application_commands(&body)
.create_global_commands(&body)
.await?;

Ok(())
Expand Down
59 changes: 30 additions & 29 deletions okto_framework/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,29 +1,30 @@
mod handler;
pub mod structs;

pub mod macros {
pub use slash_command_macros::command;
}

pub use handler::Handler;

#[macro_export]
macro_rules! create_framework {
($token:expr, $id:expr $(, $c:ident )*) => {
{
okto_framework::paste_expr! {
let mut fr = okto_framework::Handler::new();
$(
fr.add_command(&[<$c _COMMAND>]).unwrap();
)*
let mut http = serenity::http::Http::new_with_application_id($token, $id);
fr.upload_commands(&http).await.expect("Can't upload commands");
fr
}
}
}
}

#[doc(hidden)]
#[allow(unused_imports)]
pub use paste::expr as paste_expr;
mod handler;
pub mod structs;

pub mod macros {
pub use slash_command_macros::command;
}

pub use handler::Handler;

#[macro_export]
macro_rules! create_framework {
($token:expr, $id:expr $(, $c:ident )*) => {
{
okto_framework::paste_expr! {
let mut fr = okto_framework::Handler::new();
$(
fr.add_command(&[<$c _COMMAND>]).unwrap();
)*
let mut http = serenity::http::Http::new($token);
http.set_application_id($id);
fr.upload_commands(&http).await.expect("Can't upload commands");
fr
}
}
}
}

#[doc(hidden)]
#[allow(unused_imports)]
pub use paste::expr as paste_expr;
4 changes: 2 additions & 2 deletions okto_framework/src/structs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use serenity::{
client::Context,
framework::standard::CommandResult,
model::{
application::interaction::application_command::ApplicationCommandInteraction,
application::CommandInteraction,
channel::ChannelType,
Permissions,
},
Expand All @@ -22,7 +22,7 @@ pub struct Command {

pub type CommandFunc = for<'fut> fn(
&'fut Context,
&'fut ApplicationCommandInteraction,
&'fut CommandInteraction,
) -> BoxFuture<'fut, CommandResult>;

#[derive(Debug, Clone)]
Expand Down
Loading

0 comments on commit 71575d1

Please sign in to comment.