Got play to work
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
CREATE TABLE IF NOT EXISTS guilds (
|
||||
id BIGINT PRIMARY KEY NOT NULL,
|
||||
bot_id BIGINT NOT NULL,
|
||||
volume DOUBLE PRECISION NOT NULL
|
||||
);
|
||||
@@ -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) })
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
|
||||
@@ -34,6 +34,7 @@ diesel::table! {
|
||||
diesel::table! {
|
||||
guilds (id) {
|
||||
id -> BigInt,
|
||||
bot_id -> BigInt,
|
||||
volume -> Float8,
|
||||
}
|
||||
}
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user