Got play to work

This commit is contained in:
Benjamin Sherriff
2023-10-07 23:26:12 -04:00
parent 690a327084
commit 0ec6264bfa
5 changed files with 10 additions and 3 deletions

View File

@@ -74,7 +74,11 @@ impl EventHandler for Handler {
warn!("No ready guilds found");
}
for guild in ready.guilds {
let _ = InsertGuild::insert(InsertGuild { id: (guild.id.0 as i64), volume: 100.0 });
let _ = InsertGuild::insert(InsertGuild {
id: (guild.id.0 as i64),
bot_id: ctx.cache.current_user().id.0 as i64,
volume: 100.0
});
let commands = guild.id.set_application_commands(&ctx.http, |commands| {
commands.create_application_command(|command: &mut serenity::builder::CreateApplicationCommand| { commands::ping::register(command) })
.create_application_command(|command: &mut serenity::builder::CreateApplicationCommand| { commands::audio::play::register(command) })

View File

@@ -8,6 +8,7 @@ use crate::db::{schema::guilds, connection};
#[diesel(table_name = guilds)]
pub struct QueryGuild {
pub id: i64,
pub bot_id: i64,
pub volume: f64
}
@@ -23,6 +24,7 @@ impl QueryGuild {
#[diesel(table_name = guilds)]
pub struct InsertGuild {
pub id: i64,
pub bot_id: i64,
pub volume: f64
}

View File

@@ -34,6 +34,7 @@ diesel::table! {
diesel::table! {
guilds (id) {
id -> BigInt,
bot_id -> BigInt,
volume -> Float8,
}
}

View File

@@ -79,7 +79,7 @@ async fn main() -> std::io::Result<()> {
.event_handler(handler)
.framework(StandardFramework::new()
.configure(|c| c.owners(owners)))
.register_songbird()
.register_songbird_with(Arc::clone(&songbird))
.await
.expect("Error creating client");
@@ -116,7 +116,6 @@ async fn main() -> std::io::Result<()> {
.allow_any_header()
.max_age(3600);
App::new()
// .app_data(web::Data::new(Arc::clone(&http)))
.app_data(web::Data::new(Arc::clone(&app_data)))
.configure(crate::db::messages::init_routes)
.configure(crate::db::spells::init_routes)