aboutsummaryrefslogtreecommitdiffstats
path: root/src/main.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/main.rs b/src/main.rs
index 31c9e94..7f57421 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -49,7 +49,7 @@ pub struct Data {
49 /// next keystroke's autocomplete can serve real results immediately. 49 /// next keystroke's autocomplete can serve real results immediately.
50 pub ac_search_cache: AcSearchCache, 50 pub ac_search_cache: AcSearchCache,
51 /// Active music track per guild (only one music source at a time). 51 /// Active music track per guild (only one music source at a time).
52 pub music_tracks: tokio::sync::Mutex<HashMap<u64, songbird::tracks::TrackHandle>>, 52 pub music_tracks: Arc<tokio::sync::Mutex<HashMap<u64, songbird::tracks::TrackHandle>>>,
53} 53}
54 54
55impl Data { 55impl Data {
@@ -185,6 +185,8 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
185 Box::pin(async move { 185 Box::pin(async move {
186 let vm = voice::VoiceManager::new(ctx).await?; 186 let vm = voice::VoiceManager::new(ctx).await?;
187 187
188 let music_tracks: Arc<tokio::sync::Mutex<HashMap<u64, songbird::tracks::TrackHandle>>> = Arc::new(tokio::sync::Mutex::new(HashMap::new()));
189
188 let data = Data { 190 let data = Data {
189 config, 191 config,
190 db_pool, 192 db_pool,
@@ -195,7 +197,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
195 triggers: tokio::sync::Mutex::new(triggers), 197 triggers: tokio::sync::Mutex::new(triggers),
196 ac_cache: tokio::sync::Mutex::new(HashMap::new()), 198 ac_cache: tokio::sync::Mutex::new(HashMap::new()),
197 ac_search_cache: Arc::new(tokio::sync::Mutex::new(HashMap::new())), 199 ac_search_cache: Arc::new(tokio::sync::Mutex::new(HashMap::new())),
198 music_tracks: tokio::sync::Mutex::new(HashMap::new()), 200 music_tracks: music_tracks.clone(),
199 }; 201 };
200 202
201 // Spawn cron scheduler loop. 203 // Spawn cron scheduler loop.
@@ -205,6 +207,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
205 http: ctx.http.clone(), 207 http: ctx.http.clone(),
206 voice_manager: data.voice_manager.clone(), 208 voice_manager: data.voice_manager.clone(),
207 copyparty: data.copyparty.clone(), 209 copyparty: data.copyparty.clone(),
210 music_tracks: music_tracks.clone(),
208 }; 211 };
209 tokio::spawn(async move { 212 tokio::spawn(async move {
210 crate::tasks::cron_scheduler_loop(cron_ctx).await; 213 crate::tasks::cron_scheduler_loop(cron_ctx).await;