main.rs 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. use serenity::{
  2. async_trait,
  3. client::{Client, Context, EventHandler},
  4. framework::standard::{StandardFramework, Configuration},
  5. model::gateway::{GatewayIntents, Ready},
  6. };
  7. use std::env;
  8. use songbird::SerenityInit;
  9. mod audio;
  10. mod util;
  11. struct Handler;
  12. #[async_trait]
  13. impl EventHandler for Handler {
  14. async fn ready(&self, _: Context, _: Ready) {
  15. println!("bot connected");
  16. }
  17. }
  18. #[tokio::main]
  19. async fn main() {
  20. let token = env::var("OCTAVE_BOT_TOKEN").expect("Error: token not found");
  21. let framework = StandardFramework::new()
  22. .group(&audio::AUDIO_GROUP);
  23. framework
  24. .configure(Configuration::new().prefix("!"));
  25. let intents = GatewayIntents::non_privileged() | GatewayIntents::MESSAGE_CONTENT;
  26. let mut client = Client::builder(token, intents)
  27. .event_handler(Handler)
  28. .framework(framework)
  29. .register_songbird()
  30. .await
  31. .expect("Error creating client");
  32. if let Err(why) = client.start().await {
  33. println!("Error starting client: {:?}", why);
  34. }
  35. }