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

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,6 +1,6 @@
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 tokio::sync::RwLock;

View File

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

View File

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

View File

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