updated to await_next branch
This commit is contained in:
@ -37,7 +37,7 @@ SELECT id, name, prefix, volume, allow_greets
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn create_from_guild(guild: Guild, db_pool: MySqlPool) -> Result<GuildData, Box<dyn std::error::Error>> {
|
||||
pub async fn create_from_guild(guild: Guild, db_pool: MySqlPool) -> Result<GuildData, Box<dyn std::error::Error + Send + Sync>> {
|
||||
sqlx::query!(
|
||||
"
|
||||
INSERT INTO servers (id, name)
|
||||
@ -66,7 +66,7 @@ INSERT IGNORE INTO roles (guild_id, role)
|
||||
})
|
||||
}
|
||||
|
||||
pub async fn commit(&self, db_pool: MySqlPool) -> Result<(), Box<dyn std::error::Error>> {
|
||||
pub async fn commit(&self, db_pool: MySqlPool) -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
|
||||
sqlx::query!(
|
||||
"
|
||||
UPDATE servers
|
||||
|
@ -361,7 +361,7 @@ SELECT name, id, plays, public, server_id, uploader_id
|
||||
}
|
||||
|
||||
async fn play_audio(sound: &mut Sound, guild: GuildData, handler: &mut VoiceHandler, mut voice_guilds: MutexGuard<'_, HashMap<GuildId, u8>>, pool: MySqlPool)
|
||||
-> Result<(), Box<dyn std::error::Error>> {
|
||||
-> Result<(), Box<dyn std::error::Error + Send + Sync>> {
|
||||
|
||||
let audio = handler.play_only(sound.store_sound_source(pool.clone()).await?);
|
||||
|
||||
@ -401,7 +401,7 @@ async fn dispatch_error_hook(ctx: &Context, msg: &Message, error: DispatchError)
|
||||
|
||||
// entry point
|
||||
#[tokio::main]
|
||||
async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
|
||||
|
||||
dotenv()?;
|
||||
|
||||
@ -995,7 +995,7 @@ async fn delete_sound(ctx: &Context, msg: &Message, args: Args) -> CommandResult
|
||||
Ok(())
|
||||
}
|
||||
|
||||
async fn format_search_results(search_results: Vec<Sound>, msg: &Message, ctx: &Context) -> Result<(), Box<dyn std::error::Error>> {
|
||||
async fn format_search_results(search_results: Vec<Sound>, msg: &Message, ctx: &Context) -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
|
||||
let mut current_character_count = 0;
|
||||
let title = "Public sounds matching filter:";
|
||||
|
||||
|
14
src/sound.rs
14
src/sound.rs
@ -132,7 +132,7 @@ SELECT src
|
||||
return record.src
|
||||
}
|
||||
|
||||
pub async fn store_sound_source(&self, db_pool: MySqlPool) -> Result<Box<dyn AudioSource>, Box<dyn std::error::Error>> {
|
||||
pub async fn store_sound_source(&self, db_pool: MySqlPool) -> Result<Box<dyn AudioSource>, Box<dyn std::error::Error + Send + Sync>> {
|
||||
|
||||
let caching_location = env::var("CACHING_LOCATION").unwrap_or(String::from("/tmp"));
|
||||
|
||||
@ -182,7 +182,7 @@ SELECT COUNT(1) as count
|
||||
Ok(c as u32)
|
||||
}
|
||||
|
||||
pub async fn set_as_greet(&self, user_id: u64, db_pool: MySqlPool) -> Result<(), Box<dyn std::error::Error>> {
|
||||
pub async fn set_as_greet(&self, user_id: u64, db_pool: MySqlPool) -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
|
||||
sqlx::query!(
|
||||
"
|
||||
UPDATE users
|
||||
@ -199,7 +199,7 @@ WHERE
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub async fn commit(&self, db_pool: MySqlPool) -> Result<(), Box<dyn std::error::Error>> {
|
||||
pub async fn commit(&self, db_pool: MySqlPool) -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
|
||||
sqlx::query!(
|
||||
"
|
||||
UPDATE sounds
|
||||
@ -217,7 +217,7 @@ WHERE
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub async fn delete(&self, db_pool: MySqlPool) -> Result<(), Box<dyn std::error::Error>> {
|
||||
pub async fn delete(&self, db_pool: MySqlPool) -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
|
||||
sqlx::query!(
|
||||
"
|
||||
DELETE
|
||||
@ -232,7 +232,7 @@ DELETE
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub async fn create_anon(name: &str, src_url: &str, server_id: u64, user_id: u64, db_pool: MySqlPool) -> Result<u64, Box<dyn std::error::Error + Send>> {
|
||||
pub async fn create_anon(name: &str, src_url: &str, server_id: u64, user_id: u64, db_pool: MySqlPool) -> Result<u64, Box<dyn std::error::Error + Send + Sync + Send>> {
|
||||
async fn process_src(src_url: &str) -> Option<Vec<u8>> {
|
||||
let future = Command::new("ffmpeg")
|
||||
.arg("-i")
|
||||
@ -287,7 +287,7 @@ INSERT INTO sounds (name, server_id, uploader_id, public, src)
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn get_user_sounds(user_id: u64, db_pool: MySqlPool) -> Result<Vec<Sound>, Box<dyn std::error::Error>> {
|
||||
pub async fn get_user_sounds(user_id: u64, db_pool: MySqlPool) -> Result<Vec<Sound>, Box<dyn std::error::Error + Send + Sync>> {
|
||||
let sounds = sqlx::query_as_unchecked!(
|
||||
Sound,
|
||||
"
|
||||
@ -301,7 +301,7 @@ SELECT name, id, plays, public, server_id, uploader_id
|
||||
Ok(sounds)
|
||||
}
|
||||
|
||||
pub async fn get_guild_sounds(guild_id: u64, db_pool: MySqlPool) -> Result<Vec<Sound>, Box<dyn std::error::Error>> {
|
||||
pub async fn get_guild_sounds(guild_id: u64, db_pool: MySqlPool) -> Result<Vec<Sound>, Box<dyn std::error::Error + Send + Sync>> {
|
||||
let sounds = sqlx::query_as_unchecked!(
|
||||
Sound,
|
||||
"
|
||||
|
Reference in New Issue
Block a user