playing works
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
mod workers;
|
||||
|
||||
use std::{env, num::NonZeroU64, path::PathBuf, str::FromStr};
|
||||
use std::env;
|
||||
|
||||
use futures::StreamExt;
|
||||
use postcard::{from_bytes, to_stdvec};
|
||||
@@ -10,7 +10,7 @@ use serenity::{
|
||||
async_trait,
|
||||
};
|
||||
use songbird::SerenityInit;
|
||||
use types::{jobs::{JobResponse, Jobs, PlayJob}, misc::new_uuid_v4};
|
||||
use types::jobs::{JobResponse, Jobs};
|
||||
use which::which;
|
||||
use yt_dlp::{Downloader, client::Libraries};
|
||||
|
||||
@@ -49,12 +49,7 @@ impl EventHandler for Handler {
|
||||
error: res.error,
|
||||
}),
|
||||
"play" => {
|
||||
workers::play::play(&voice_manager, PlayJob {
|
||||
uuid: new_uuid_v4(),
|
||||
path: PathBuf::new(),
|
||||
guild_id: NonZeroU64::from_str("302837320250294283").unwrap(),
|
||||
channel_id: NonZeroU64::from_str("863014198703423499").unwrap()
|
||||
})
|
||||
workers::play::play(&voice_manager, from_bytes(&message.payload).unwrap())
|
||||
.await
|
||||
.map(|res| JobResponse {
|
||||
content: res.content.map(Jobs::Play),
|
||||
@@ -86,6 +81,10 @@ impl EventHandler for Handler {
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() {
|
||||
rustls::crypto::ring::default_provider()
|
||||
.install_default()
|
||||
.expect("Failed to install rustls crypto provider");
|
||||
|
||||
let discord_token = env::var("DISCORD_TOKEN").expect("Expected a token in the environment");
|
||||
|
||||
let nats_client = async_nats::connect("nats://localhost:4222")
|
||||
@@ -105,7 +104,7 @@ async fn main() {
|
||||
yt_downloader,
|
||||
};
|
||||
|
||||
let mut discord_client = Client::builder(&discord_token, GatewayIntents::empty())
|
||||
let mut discord_client = Client::builder(&discord_token, GatewayIntents::non_privileged())
|
||||
.event_handler(handler)
|
||||
.register_songbird()
|
||||
.await
|
||||
|
||||
Reference in New Issue
Block a user