From f20b95a482e254da96999840f839559d1db16486 Mon Sep 17 00:00:00 2001 From: jude Date: Thu, 8 Sep 2022 17:58:05 +0100 Subject: [PATCH] Upgrade poise. Combine remind/multiline into one command --- Cargo.lock | 92 ++++++++++++++----------------- Cargo.toml | 6 +- src/commands/moderation_cmds.rs | 4 +- src/commands/reminder_cmds.rs | 65 ++++++++++++---------- src/component_models/mod.rs | 6 +- src/component_models/pager.rs | 4 +- src/consts.rs | 2 +- src/event_handlers.rs | 2 +- src/hooks.rs | 2 +- src/main.rs | 5 +- src/models/channel_data.rs | 2 +- src/models/command_macro.rs | 2 +- src/models/mod.rs | 2 +- src/models/reminder/builder.rs | 2 +- src/models/reminder/look_flags.rs | 2 +- src/models/reminder/mod.rs | 6 +- src/models/user_data.rs | 2 +- src/utils.rs | 12 ++-- 18 files changed, 108 insertions(+), 110 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 8b302b7..9b40a56 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -56,9 +56,9 @@ dependencies = [ [[package]] name = "aho-corasick" -version = "0.7.18" +version = "0.7.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e37cfd5e7657ada45f742d6e99ca5788580b5c529dc78faf11ece6dc702656f" +checksum = "b4f55bd91a0978cbfd91c457a164bab8b4001c833b7f323132c0a4e1922dd44e" dependencies = [ "memchr", ] @@ -201,9 +201,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "block-buffer" -version = "0.10.2" +version = "0.10.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0bf7fe51849ea569fd452f37822f606a5cabb684dc918707a0193fd4664ff324" +checksum = "69cce20737498f97b993470a6e536b8523f0af7892a4f928cceb1ac5e52ebe7e" dependencies = [ "generic-array", ] @@ -356,9 +356,9 @@ checksum = "5827cebf4670468b8772dd191856768aedcb1b0278a04f989f7766351917b9dc" [[package]] name = "cpufeatures" -version = "0.2.4" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc948ebb96241bb40ab73effeb80d9f93afaad49359d159a5e61be51619fe813" +checksum = "28d997bd5e24a5928dd43e46dc529867e207907fe0b239c3477d924f7f2ca320" dependencies = [ "libc", ] @@ -460,9 +460,9 @@ dependencies = [ [[package]] name = "darling" -version = "0.12.4" +version = "0.14.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f2c43f534ea4b0b049015d00269734195e6d3f0f6635cb692251aca6f9f8b3c" +checksum = "4529658bdda7fd6769b8614be250cdcfc3aeb0ee72fe66f9e41e5e5eb73eac02" dependencies = [ "darling_core", "darling_macro", @@ -470,9 +470,9 @@ dependencies = [ [[package]] name = "darling_core" -version = "0.12.4" +version = "0.14.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e91455b86830a1c21799d94524df0845183fa55bafd9aa137b01c7d1065fa36" +checksum = "649c91bc01e8b1eac09fb91e8dbc7d517684ca6be8ebc75bb9cafc894f9fdb6f" dependencies = [ "fnv", "ident_case", @@ -484,9 +484,9 @@ dependencies = [ [[package]] name = "darling_macro" -version = "0.12.4" +version = "0.14.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29b5acf0dea37a7f66f7b25d2c5e93fd46f8f6968b1a5d7a3e02e97768afc95a" +checksum = "ddfc69c5bfcbd2fc09a0f38451d2daf0e372e367986a83906d1b0dbc88134fb5" dependencies = [ "darling_core", "quote", @@ -659,9 +659,9 @@ dependencies = [ [[package]] name = "figment" -version = "0.10.6" +version = "0.10.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "790b4292c72618abbab50f787a477014fe15634f96291de45672ce46afe122df" +checksum = "6e3bd154d9ae2f1bb0ada5b7eebd56529513efa5de7d2fc8c6adf33bc43260cf" dependencies = [ "atomic", "pear", @@ -716,11 +716,10 @@ checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" [[package]] name = "form_urlencoded" -version = "1.0.1" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5fc25a87fa4fd2094bffb06925852034d90a17f0d1e05197d4956d3555752191" +checksum = "a9c384f161156f5260c24a097c56119f9be8c798586aecc13afbcbe7b7e26bf8" dependencies = [ - "matches", "percent-encoding", ] @@ -1119,11 +1118,10 @@ checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" [[package]] name = "idna" -version = "0.2.3" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "418a0a6fab821475f634efe3ccc45c013f742efe03d853e8d3355d5cb850ecf8" +checksum = "e14ddfc70884202db2244c223200c204c2bda1bc6e0998d11b5e024d657209e6" dependencies = [ - "matches", "unicode-bidi", "unicode-normalization", ] @@ -1346,12 +1344,6 @@ dependencies = [ "regex-automata", ] -[[package]] -name = "matches" -version = "0.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3e378b66a060d48947b590737b30a1be76706c8dd7b8ba0f2fe3989c68a853f" - [[package]] name = "memchr" version = "2.5.0" @@ -1382,9 +1374,9 @@ checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" [[package]] name = "miniz_oxide" -version = "0.5.3" +version = "0.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f5c75688da582b8ffc1f1799e9db273f32133c49e048f614d22ec3256773ccc" +checksum = "96590ba8f175222643a85693f33d26e9c8a015f599c216509b1a6894af675d34" dependencies = [ "adler", ] @@ -1791,9 +1783,9 @@ dependencies = [ [[package]] name = "percent-encoding" -version = "2.1.0" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e" +checksum = "478c572c3d73181ff3c2539045f6eb99e5491218eae919370993b890cdbdd98e" [[package]] name = "pest" @@ -1920,9 +1912,9 @@ checksum = "1df8c4ec4b0627e53bdf214615ad287367e482558cf84b109250b37464dc03ae" [[package]] name = "poise" -version = "0.2.2" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8af8ef2efaa133d674482f40665db3424cb2c5660a2707918c869603c843b7ad" +checksum = "f6c01d22dcda434b0dfe956c60f6ac9b0352c4c2f4af852afb3155a971cd306d" dependencies = [ "async-trait", "derivative", @@ -1930,6 +1922,7 @@ dependencies = [ "futures-util", "log", "once_cell", + "parking_lot 0.12.1", "poise_macros", "regex", "serenity", @@ -1938,9 +1931,9 @@ dependencies = [ [[package]] name = "poise_macros" -version = "0.2.1" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94d99712c7e3cef666f344ccf5c5c729939331096d16c35eba3275028191a1af" +checksum = "52ff861b6a52ec47bc54eb17424c025feeb040e82836036276c25dda045a8a0c" dependencies = [ "darling", "proc-macro2", @@ -2152,7 +2145,7 @@ checksum = "a3f87b73ce11b1619a3c6332f45341e0047173771e8b8b73f87bfeefb7b56244" [[package]] name = "reminder_rs" -version = "1.6.4" +version = "1.6.5" dependencies = [ "base64", "chrono", @@ -2279,9 +2272,9 @@ dependencies = [ [[package]] name = "rmp-serde" -version = "0.15.5" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "723ecff9ad04f4ad92fe1c8ca6c20d2196d9286e9c60727c4cb5511629260e9d" +checksum = "25786b0d276110195fa3d6f3f31299900cf71dfbd6c28450f3f58a0e7f7a347e" dependencies = [ "byteorder", "rmp", @@ -2909,18 +2902,18 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.33" +version = "1.0.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d0a539a918745651435ac7db7a18761589a94cd7e94cd56999f828bf73c8a57" +checksum = "8c1b05ca9d106ba7d2e31a9dab4a64e7be2cce415321966ea3132c49a656e252" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.33" +version = "1.0.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c251e90f708e16c49a16f4917dc2131e75222b72edfa9cb7f7c58ae56aae0c09" +checksum = "e8f2591983642de85c921015f3f070c665a197ed69e417af436115e3a1407487" dependencies = [ "proc-macro2", "quote", @@ -3047,9 +3040,9 @@ dependencies = [ [[package]] name = "tokio-util" -version = "0.7.3" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc463cd8deddc3770d20f9852143d50bf6094e640b485cb2e189a2099085ff45" +checksum = "0bb2e075f03b3d66d8d8785356224ba688d2906a371015e225beeb65ca92c740" dependencies = [ "bytes", "futures-core", @@ -3178,18 +3171,18 @@ checksum = "dcf81ac59edc17cc8697ff311e8f5ef2d99fcbd9817b34cec66f90b6c3dfd987" [[package]] name = "ubyte" -version = "0.10.2" +version = "0.10.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a58e29f263341a29bb79e14ad7fda5f63b1c7e48929bad4c685d7876b1d04e94" +checksum = "c81f0dae7d286ad0d9366d7679a77934cfc3cf3a8d67e82669794412b2368fe6" dependencies = [ "serde", ] [[package]] name = "ucd-trie" -version = "0.1.4" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89570599c4fe5585de2b388aab47e99f7fa4e9238a1399f707a02e356058141c" +checksum = "9e79c4d996edb816c91e4308506774452e55e95c3c9de07b6729e17e15a5ef81" [[package]] name = "uncased" @@ -3317,13 +3310,12 @@ checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" [[package]] name = "url" -version = "2.2.2" +version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a507c383b2d33b5fc35d1861e77e6b383d158b2da5e14fe51b83dfedf6fd578c" +checksum = "0d68c799ae75762b8c3fe375feb6600ef5602c883c5d21eb51c09f22b83c4643" dependencies = [ "form_urlencoded", "idna", - "matches", "percent-encoding", "serde", ] diff --git a/Cargo.toml b/Cargo.toml index 2bf3a52..4e9c580 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,11 +1,11 @@ [package] name = "reminder_rs" -version = "1.6.4" +version = "1.6.5" authors = ["jellywx "] edition = "2018" [dependencies] -poise = "0.2" +poise = "0.3" dotenv = "0.15" tokio = { version = "1", features = ["process", "full"] } reqwest = "0.11" @@ -20,7 +20,7 @@ num-integer = "0.1" serde = "1.0" serde_json = "1.0" serde_repr = "0.1" -rmp-serde = "0.15" +rmp-serde = "1.1" rand = "0.8" levenshtein = "1.0" sqlx = { version = "0.6", features = ["runtime-tokio-rustls", "macros", "mysql", "bigdecimal", "chrono"]} diff --git a/src/commands/moderation_cmds.rs b/src/commands/moderation_cmds.rs index ddb8345..e65ee9a 100644 --- a/src/commands/moderation_cmds.rs +++ b/src/commands/moderation_cmds.rs @@ -18,7 +18,7 @@ use crate::{ Context, Data, Error, GuildId, }; -async fn timezone_autocomplete(ctx: Context<'_>, partial: String) -> Vec { +async fn timezone_autocomplete(ctx: Context<'_>, partial: &str) -> Vec { if partial.is_empty() { ctx.data().popular_timezones.iter().map(|t| t.to_string()).collect::>() } else { @@ -206,7 +206,7 @@ Do not share it! Ok(()) } -async fn macro_name_autocomplete(ctx: Context<'_>, partial: String) -> Vec { +async fn macro_name_autocomplete(ctx: Context<'_>, partial: &str) -> Vec { sqlx::query!( " SELECT name diff --git a/src/commands/reminder_cmds.rs b/src/commands/reminder_cmds.rs index d9a27d2..47db558 100644 --- a/src/commands/reminder_cmds.rs +++ b/src/commands/reminder_cmds.rs @@ -8,8 +8,9 @@ use chrono::NaiveDateTime; use chrono_tz::Tz; use num_integer::Integer; use poise::{ - serenity::{builder::CreateEmbed, model::channel::Channel}, - serenity_prelude::{component::ButtonStyle, ReactionType}, + serenity_prelude::{ + builder::CreateEmbed, component::ButtonStyle, model::channel::Channel, ReactionType, + }, CreateReply, Modal, }; @@ -558,40 +559,16 @@ struct ContentModal { content: String, } -/// Create a new reminder with multiline content -#[poise::command( - slash_command, - rename = "multiline", - identifying_name = "remind_multiline", - default_member_permissions = "MANAGE_GUILD" -)] -pub async fn remind_multiline( - ctx: ApplicationContext<'_>, - #[description = "A description of the time to set the reminder for"] time: String, - #[description = "Channel or user mentions to set the reminder for"] channels: Option, - #[description = "(Patreon only) Time to wait before repeating the reminder. Leave blank for one-shot reminder"] - interval: Option, - #[description = "(Patreon only) For repeating reminders, the time at which the reminder will stop repeating"] - expires: Option, - #[description = "Set the TTS flag on the reminder message, similar to the /tts command"] - tts: Option, -) -> Result<(), Error> { - let data = ContentModal::execute(ctx).await?; - - create_reminder(Context::Application(ctx), time, data.content, channels, interval, expires, tts) - .await -} - -/// Create a new reminder +/// Create a reminder. Press "+5 more" for other options. A modal will open if "content" is not provided #[poise::command( slash_command, identifying_name = "remind", default_member_permissions = "MANAGE_GUILD" )] pub async fn remind( - ctx: Context<'_>, + ctx: ApplicationContext<'_>, #[description = "A description of the time to set the reminder for"] time: String, - #[description = "The message content to send"] content: String, + #[description = "The message content to send"] content: Option, #[description = "Channel or user mentions to set the reminder for"] channels: Option, #[description = "(Patreon only) Time to wait before repeating the reminder. Leave blank for one-shot reminder"] interval: Option, @@ -600,7 +577,35 @@ pub async fn remind( #[description = "Set the TTS flag on the reminder message, similar to the /tts command"] tts: Option, ) -> Result<(), Error> { - create_reminder(ctx, time, content, channels, interval, expires, tts).await + match content { + Some(content) => { + create_reminder( + Context::Application(ctx), + time, + content, + channels, + interval, + expires, + tts, + ) + .await + } + + None => { + let data = ContentModal::execute(ctx).await?; + + create_reminder( + Context::Application(ctx), + time, + data.content, + channels, + interval, + expires, + tts, + ) + .await + } + } } async fn create_reminder( diff --git a/src/component_models/mod.rs b/src/component_models/mod.rs index b8e8598..dec1062 100644 --- a/src/component_models/mod.rs +++ b/src/component_models/mod.rs @@ -5,9 +5,9 @@ use std::io::Cursor; use chrono_tz::Tz; use log::warn; use poise::{ - serenity::{ + serenity_prelude as serenity, + serenity_prelude::{ builder::CreateEmbed, - client::Context, model::{ application::interaction::{ message_component::MessageComponentInteraction, InteractionResponseType, @@ -15,8 +15,8 @@ use poise::{ }, channel::Channel, }, + Context, }, - serenity_prelude as serenity, }; use rmp_serde::Serializer; use serde::{Deserialize, Serialize}; diff --git a/src/component_models/pager.rs b/src/component_models/pager.rs index fcef2fd..e9ff7bd 100644 --- a/src/component_models/pager.rs +++ b/src/component_models/pager.rs @@ -1,6 +1,8 @@ // todo split pager out into a single struct use chrono_tz::Tz; -use poise::serenity::{builder::CreateComponents, model::application::component::ButtonStyle}; +use poise::serenity_prelude::{ + builder::CreateComponents, model::application::component::ButtonStyle, +}; use serde::{Deserialize, Serialize}; use serde_repr::*; diff --git a/src/consts.rs b/src/consts.rs index 746e156..f63f0fb 100644 --- a/src/consts.rs +++ b/src/consts.rs @@ -12,7 +12,7 @@ pub const MACRO_MAX_COMMANDS: usize = 5; use std::{collections::HashSet, env, iter::FromIterator}; -use poise::serenity::model::prelude::AttachmentType; +use poise::serenity_prelude::model::prelude::AttachmentType; use regex::Regex; lazy_static! { diff --git a/src/event_handlers.rs b/src/event_handlers.rs index e47585d..6c9ff56 100644 --- a/src/event_handlers.rs +++ b/src/event_handlers.rs @@ -1,8 +1,8 @@ use std::{collections::HashMap, env}; use poise::{ - serenity::{model::application::interaction::Interaction, utils::shard_id}, serenity_prelude as serenity, + serenity_prelude::{model::application::interaction::Interaction, utils::shard_id}, }; use crate::{component_models::ComponentDataModel, Data, Error}; diff --git a/src/hooks.rs b/src/hooks.rs index 2d434ac..81fb4d2 100644 --- a/src/hooks.rs +++ b/src/hooks.rs @@ -1,4 +1,4 @@ -use poise::serenity::model::channel::Channel; +use poise::serenity_prelude::model::channel::Channel; use crate::{consts::MACRO_MAX_COMMANDS, models::command_macro::RecordedCommand, Context, Error}; diff --git a/src/main.rs b/src/main.rs index 64e8267..2fb657a 100644 --- a/src/main.rs +++ b/src/main.rs @@ -23,7 +23,7 @@ use std::{ use chrono_tz::Tz; use dotenv::dotenv; use log::{error, warn}; -use poise::serenity::model::{ +use poise::serenity_prelude::model::{ gateway::GatewayIntents, id::{GuildId, UserId}, }; @@ -134,7 +134,6 @@ async fn _main(tx: Sender<()>) -> Result<(), Box> { ..reminder_cmds::timer_base() }, reminder_cmds::remind(), - reminder_cmds::remind_multiline(), poise::Command { subcommands: vec![ poise::Command { @@ -178,7 +177,7 @@ async fn _main(tx: Sender<()>) -> Result<(), Box> { .map(|t| t.timezone.parse::().unwrap()) .collect::>(); - poise::Framework::build() + poise::Framework::builder() .token(discord_token) .user_data_setup(move |ctx, _bot, framework| { Box::pin(async move { diff --git a/src/models/channel_data.rs b/src/models/channel_data.rs index a4d7337..c3d2f0c 100644 --- a/src/models/channel_data.rs +++ b/src/models/channel_data.rs @@ -1,5 +1,5 @@ use chrono::NaiveDateTime; -use poise::serenity::model::channel::Channel; +use poise::serenity_prelude::model::channel::Channel; use sqlx::MySqlPool; pub struct ChannelData { diff --git a/src/models/command_macro.rs b/src/models/command_macro.rs index 29e1dc7..f7b89ad 100644 --- a/src/models/command_macro.rs +++ b/src/models/command_macro.rs @@ -1,4 +1,4 @@ -use poise::serenity::model::{ +use poise::serenity_prelude::model::{ application::interaction::application_command::CommandDataOption, id::GuildId, }; use serde::{Deserialize, Serialize}; diff --git a/src/models/mod.rs b/src/models/mod.rs index a94bd20..db7e0f9 100644 --- a/src/models/mod.rs +++ b/src/models/mod.rs @@ -5,7 +5,7 @@ pub mod timer; pub mod user_data; use chrono_tz::Tz; -use poise::serenity::{async_trait, model::id::UserId}; +use poise::serenity_prelude::{async_trait, model::id::UserId}; use crate::{ models::{channel_data::ChannelData, user_data::UserData}, diff --git a/src/models/reminder/builder.rs b/src/models/reminder/builder.rs index 2fb2282..8a47db1 100644 --- a/src/models/reminder/builder.rs +++ b/src/models/reminder/builder.rs @@ -2,7 +2,7 @@ use std::{collections::HashSet, fmt::Display}; use chrono::{Duration, NaiveDateTime, Utc}; use chrono_tz::Tz; -use poise::serenity::{ +use poise::serenity_prelude::{ http::CacheHttp, model::{ channel::GuildChannel, diff --git a/src/models/reminder/look_flags.rs b/src/models/reminder/look_flags.rs index a2a87f0..9960f33 100644 --- a/src/models/reminder/look_flags.rs +++ b/src/models/reminder/look_flags.rs @@ -1,4 +1,4 @@ -use poise::serenity::model::id::ChannelId; +use poise::serenity_prelude::model::id::ChannelId; use serde::{Deserialize, Serialize}; use serde_repr::*; diff --git a/src/models/reminder/mod.rs b/src/models/reminder/mod.rs index eee1ae4..d334cd1 100644 --- a/src/models/reminder/mod.rs +++ b/src/models/reminder/mod.rs @@ -8,9 +8,9 @@ use std::hash::{Hash, Hasher}; use chrono::{NaiveDateTime, TimeZone}; use chrono_tz::Tz; -use poise::{ - serenity::model::id::{ChannelId, GuildId, UserId}, - serenity_prelude::Cache, +use poise::serenity_prelude::{ + model::id::{ChannelId, GuildId, UserId}, + Cache, }; use sqlx::Executor; diff --git a/src/models/user_data.rs b/src/models/user_data.rs index 8ba68f9..977c89d 100644 --- a/src/models/user_data.rs +++ b/src/models/user_data.rs @@ -1,6 +1,6 @@ use chrono_tz::Tz; use log::error; -use poise::serenity::{http::CacheHttp, model::id::UserId}; +use poise::serenity_prelude::{http::CacheHttp, model::id::UserId}; use sqlx::MySqlPool; use crate::consts::LOCAL_TIMEZONE; diff --git a/src/utils.rs b/src/utils.rs index 14805ab..b2eee0b 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -1,11 +1,11 @@ use poise::{ - serenity::{ + serenity_prelude as serenity, + serenity_prelude::{ builder::CreateApplicationCommands, http::CacheHttp, + interaction::MessageFlags, model::id::{GuildId, UserId}, }, - serenity_prelude as serenity, - serenity_prelude::interaction::MessageFlags, }; use crate::{ @@ -14,10 +14,10 @@ use crate::{ }; pub async fn register_application_commands( - ctx: &poise::serenity::client::Context, + ctx: &serenity::Context, framework: &poise::Framework, guild_id: Option, -) -> Result<(), poise::serenity::Error> { +) -> Result<(), serenity::Error> { let mut commands_builder = CreateApplicationCommands::default(); let commands = &framework.options().commands; for command in commands { @@ -28,7 +28,7 @@ pub async fn register_application_commands( commands_builder.add_application_command(context_menu_command); } } - let commands_builder = poise::serenity::json::Value::Array(commands_builder.0); + let commands_builder = poise::serenity_prelude::json::Value::Array(commands_builder.0); if let Some(guild_id) = guild_id { ctx.http.create_guild_application_commands(guild_id.0, &commands_builder).await?;