Update poise

This commit is contained in:
jude 2022-11-20 11:30:02 +00:00
parent 6307de331d
commit b8b17a504d
12 changed files with 443 additions and 296 deletions

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="dataSourceStorageLocal" created-in="CL-213.7172.20"> <component name="dataSourceStorageLocal" created-in="CL-222.4345.21">
<data-source name="MySQL for 5.1 - soundfx@localhost" uuid="1067c1d0-1386-4a39-b3f5-6d48d6f279eb"> <data-source name="MySQL for 5.1 - soundfx@localhost" uuid="1067c1d0-1386-4a39-b3f5-6d48d6f279eb">
<database-info product="" version="" jdbc-version="" driver-name="" driver-version="" dbms="MYSQL" exact-version="0" /> <database-info product="" version="" jdbc-version="" driver-name="" driver-version="" dbms="MYSQL" exact-version="0" />
<secret-storage>master_key</secret-storage> <secret-storage>master_key</secret-storage>

669
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -1,12 +1,12 @@
[package] [package]
name = "soundfx-rs" name = "soundfx-rs"
version = "1.5.5" version = "1.5.6"
authors = ["jellywx <judesouthworth@pm.me>"] authors = ["jellywx <judesouthworth@pm.me>"]
edition = "2018" edition = "2018"
[dependencies] [dependencies]
songbird = { version = "0.3", features = ["builtin-queue"] } songbird = { version = "0.3", features = ["builtin-queue"] }
poise = "0.2" poise = "0.3"
sqlx = { version = "0.5", default-features = false, features = ["runtime-tokio-rustls", "macros", "mysql", "bigdecimal"] } sqlx = { version = "0.5", default-features = false, features = ["runtime-tokio-rustls", "macros", "mysql", "bigdecimal"] }
tokio = { version = "1", features = ["fs", "process", "io-util"] } tokio = { version = "1", features = ["fs", "process", "io-util"] }
lazy_static = "1.4" lazy_static = "1.4"

View File

@ -101,12 +101,7 @@ pub async fn upload_new_sound(
} }
/// Delete a sound you have uploaded /// Delete a sound you have uploaded
#[poise::command( #[poise::command(slash_command, rename = "delete", guild_only = true)]
slash_command,
rename = "delete",
category = "Manage",
guild_only = true
)]
pub async fn delete_sound( pub async fn delete_sound(
ctx: Context<'_>, ctx: Context<'_>,
#[description = "Name or ID of sound to delete"] #[description = "Name or ID of sound to delete"]
@ -159,12 +154,7 @@ pub async fn delete_sound(
} }
/// Change a sound between public and private /// Change a sound between public and private
#[poise::command( #[poise::command(slash_command, rename = "public", guild_only = true)]
slash_command,
rename = "public",
category = "Manage",
guild_only = true
)]
pub async fn change_public( pub async fn change_public(
ctx: Context<'_>, ctx: Context<'_>,
#[description = "Name or ID of sound to change privacy setting of"] #[description = "Name or ID of sound to change privacy setting of"]
@ -207,12 +197,7 @@ pub async fn change_public(
} }
/// Download a sound file from the bot /// Download a sound file from the bot
#[poise::command( #[poise::command(slash_command, rename = "download", guild_only = true)]
slash_command,
rename = "download",
category = "Manage",
guild_only = true
)]
pub async fn download_file( pub async fn download_file(
ctx: Context<'_>, ctx: Context<'_>,
#[description = "Name or ID of sound to download"] #[description = "Name or ID of sound to download"]

View File

@ -9,7 +9,7 @@ pub mod stop;
pub async fn autocomplete_sound( pub async fn autocomplete_sound(
ctx: Context<'_>, ctx: Context<'_>,
partial: String, partial: &str,
) -> Vec<poise::AutocompleteChoice<String>> { ) -> Vec<poise::AutocompleteChoice<String>> {
ctx.data() ctx.data()
.autocomplete_user_sounds(&partial, ctx.author().id, ctx.guild_id().unwrap()) .autocomplete_user_sounds(&partial, ctx.author().id, ctx.guild_id().unwrap())

View File

@ -1,6 +1,5 @@
use poise::{ use poise::serenity_prelude::{
serenity::{builder::CreateActionRow, model::application::component::ButtonStyle}, builder::CreateActionRow, model::application::component::ButtonStyle, GuildChannel,
serenity_prelude::GuildChannel,
}; };
use crate::{ use crate::{

View File

@ -1,15 +1,12 @@
use std::{collections::HashMap, env}; use std::{collections::HashMap, env};
use poise::{ use poise::serenity_prelude::{
serenity::{
model::{ model::{
application::interaction::{Interaction, InteractionResponseType}, application::interaction::{Interaction, InteractionResponseType},
channel::Channel, channel::Channel,
}, },
prelude::Context,
utils::shard_id, utils::shard_id,
}, Activity, Context,
serenity_prelude::Activity,
}; };
use crate::{ use crate::{

View File

@ -11,7 +11,7 @@ mod utils;
use std::{env, sync::Arc}; use std::{env, sync::Arc};
use dashmap::DashMap; use dashmap::DashMap;
use poise::serenity::{ use poise::serenity_prelude::{
builder::CreateApplicationCommands, builder::CreateApplicationCommands,
model::{ model::{
gateway::GatewayIntents, gateway::GatewayIntents,
@ -37,10 +37,10 @@ type Error = Box<dyn std::error::Error + Send + Sync>;
type Context<'a> = poise::Context<'a, Data, Error>; type Context<'a> = poise::Context<'a, Data, Error>;
pub async fn register_application_commands( pub async fn register_application_commands(
ctx: &poise::serenity::client::Context, ctx: &poise::serenity_prelude::Context,
framework: &poise::Framework<Data, Error>, framework: &poise::Framework<Data, Error>,
guild_id: Option<GuildId>, guild_id: Option<GuildId>,
) -> Result<(), poise::serenity::Error> { ) -> Result<(), poise::serenity_prelude::Error> {
let mut commands_builder = CreateApplicationCommands::default(); let mut commands_builder = CreateApplicationCommands::default();
let commands = &framework.options().commands; let commands = &framework.options().commands;
for command in commands { for command in commands {
@ -51,7 +51,7 @@ pub async fn register_application_commands(
commands_builder.add_application_command(context_menu_command); 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 { if let Some(guild_id) = guild_id {
ctx.http ctx.http
@ -128,7 +128,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
.await .await
.unwrap(); .unwrap();
poise::Framework::build() poise::Framework::builder()
.token(discord_token) .token(discord_token)
.user_data_setup(move |ctx, _bot, framework| { .user_data_setup(move |ctx, _bot, framework| {
Box::pin(async move { Box::pin(async move {

View File

@ -1,6 +1,6 @@
use std::sync::Arc; use std::sync::Arc;
use poise::serenity::{async_trait, model::id::GuildId}; use poise::serenity_prelude::{async_trait, model::id::GuildId};
use sqlx::Executor; use sqlx::Executor;
use tokio::sync::RwLock; use tokio::sync::RwLock;

View File

@ -1,7 +1,4 @@
use poise::{ use poise::serenity_prelude::{async_trait, model::id::UserId, GuildId};
serenity::{async_trait, model::id::UserId},
serenity_prelude::GuildId,
};
use crate::Data; use crate::Data;

View File

@ -1,6 +1,6 @@
use std::{env, path::Path}; use std::{env, path::Path};
use poise::serenity::async_trait; use poise::serenity_prelude::async_trait;
use songbird::input::restartable::Restartable; use songbird::input::restartable::Restartable;
use sqlx::Executor; use sqlx::Executor;
use tokio::{fs::File, io::AsyncWriteExt, process::Command}; use tokio::{fs::File, io::AsyncWriteExt, process::Command};

View File

@ -1,6 +1,6 @@
use std::sync::Arc; use std::sync::Arc;
use poise::serenity::model::{ use poise::serenity_prelude::model::{
channel::Channel, channel::Channel,
guild::Guild, guild::Guild,
id::{ChannelId, UserId}, id::{ChannelId, UserId},