123456789101112131415161718192021222324252627282930313233343536373839404142 |
- use serenity::{
- async_trait,
- client::{Client, Context, EventHandler},
- framework::StandardFramework,
- model::gateway::{GatewayIntents, Ready},
- };
- use std::env;
- use songbird::SerenityInit;
- mod audio;
- mod util;
- struct Handler;
- #[async_trait]
- impl EventHandler for Handler {
- async fn ready(&self, _: Context, _: Ready) {
- println!("bot connected");
- }
- }
- #[tokio::main]
- async fn main() {
- let token = env::var("OCTAVE_BOT_TOKEN").expect("Error: token not found");
- let framework = StandardFramework::new()
- .configure(|c| c.prefix("!"))
- .group(&audio::AUDIO_GROUP);
- let intents = GatewayIntents::non_privileged() | GatewayIntents::MESSAGE_CONTENT;
- let mut client = Client::builder(token, intents)
- .event_handler(Handler)
- .framework(framework)
- .register_songbird()
- .await
- .expect("Error creating client");
- if let Err(why) = client.start().await {
- println!("Error starting client: {:?}", why);
- }
- }
|