Browse Source

Update Discord API libraries

Frans Bergman 1 year ago
parent
commit
aca10a6533
4 changed files with 326 additions and 272 deletions
  1. 316 264
      Cargo.lock
  2. 3 3
      Cargo.toml
  3. 3 3
      src/audio/audio.rs
  4. 4 2
      src/main.rs

File diff suppressed because it is too large
+ 316 - 264
Cargo.lock


+ 3 - 3
Cargo.toml

@@ -10,8 +10,8 @@ edition = "2018"
 futures = "0.3.5"
 futures = "0.3.5"
 lazy_static = "1.4.0"
 lazy_static = "1.4.0"
 rand = "0.8.3"
 rand = "0.8.3"
-serenity = {version = "0.10", features = ["standard_framework", "voice", "rustls_backend", "cache", "framework"] }
-songbird = "0.2.0-beta.4"
+serenity = {version = "0.11", features = ["standard_framework", "voice", "rustls_backend", "cache", "framework"] }
+songbird = "0.3.2"
+symphonia-core = "0.5.2"
 tokio = { version = "1.0", features = ["macros", "rt-multi-thread", "time", "sync"] }
 tokio = { version = "1.0", features = ["macros", "rt-multi-thread", "time", "sync"] }
-symphonia-core = "0.2.0"
 serde_json = "1.0.81"
 serde_json = "1.0.81"

+ 3 - 3
src/audio/audio.rs

@@ -37,7 +37,7 @@ lazy_static! {
 }
 }
 
 
 async fn get_audio_state(ctx: &Context, msg: &Message) -> Option<Arc<Mutex<AudioState>>> {
 async fn get_audio_state(ctx: &Context, msg: &Message) -> Option<Arc<Mutex<AudioState>>> {
-    let guild = msg.guild(&ctx.cache).await.unwrap();
+    let guild = msg.guild(&ctx.cache).unwrap();
     let guild_id = guild.id;
     let guild_id = guild.id;
 
 
     let mut audio_states = AUDIO_STATES.lock().await;
     let mut audio_states = AUDIO_STATES.lock().await;
@@ -88,7 +88,7 @@ async fn get_audio_state(ctx: &Context, msg: &Message) -> Option<Arc<Mutex<Audio
     let mut call = call_lock.lock().await;
     let mut call = call_lock.lock().await;
 
 
     if call.current_channel() != Some(channel_id.into()) {
     if call.current_channel() != Some(channel_id.into()) {
-        if let Err(err) = call.join(channel_id.into()).await {
+        if let Err(err) = call.join(channel_id).await {
             println!("Error joining call: {:?}", err);
             println!("Error joining call: {:?}", err);
         }
         }
     }
     }
@@ -108,7 +108,7 @@ async fn get_audio_state(ctx: &Context, msg: &Message) -> Option<Arc<Mutex<Audio
 }
 }
 
 
 async fn remove_audio_state(ctx: &Context, msg: &Message) -> Result<(), String> {
 async fn remove_audio_state(ctx: &Context, msg: &Message) -> Result<(), String> {
-    let guild = msg.guild(&ctx.cache).await.unwrap();
+    let guild = msg.guild(&ctx.cache).unwrap();
     let guild_id = guild.id;
     let guild_id = guild.id;
 
 
     let mut audio_states = AUDIO_STATES.lock().await;
     let mut audio_states = AUDIO_STATES.lock().await;

+ 4 - 2
src/main.rs

@@ -2,7 +2,7 @@ use serenity::{
     async_trait,
     async_trait,
     client::{Client, Context, EventHandler},
     client::{Client, Context, EventHandler},
     framework::StandardFramework,
     framework::StandardFramework,
-    model::gateway::Ready,
+    model::gateway::{GatewayIntents, Ready},
 };
 };
 use std::env;
 use std::env;
 
 
@@ -27,7 +27,9 @@ async fn main() {
         .configure(|c| c.prefix("!"))
         .configure(|c| c.prefix("!"))
         .group(&audio::AUDIO_GROUP);
         .group(&audio::AUDIO_GROUP);
 
 
-    let mut client = Client::builder(token)
+    let intents = GatewayIntents::non_privileged() | GatewayIntents::MESSAGE_CONTENT;
+
+    let mut client = Client::builder(token, intents)
         .event_handler(Handler)
         .event_handler(Handler)
         .framework(framework)
         .framework(framework)
         .register_songbird()
         .register_songbird()

Some files were not shown because too many files changed in this diff