Cargo Format
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
use serenity::framework::standard::macros::{group};
|
use serenity::framework::standard::macros::group;
|
||||||
pub mod ping;
|
pub mod ping;
|
||||||
use ping::*;
|
use ping::*;
|
||||||
|
|
||||||
|
|||||||
@@ -15,9 +15,9 @@ impl EventHandler for Handler {
|
|||||||
// In this case, just print what the current user's username is.
|
// In this case, just print what the current user's username is.
|
||||||
async fn ready(&self, ctx: Context, ready: Ready) {
|
async fn ready(&self, ctx: Context, ready: Ready) {
|
||||||
println!("{} is connected!", ready.user.name);
|
println!("{} is connected!", ready.user.name);
|
||||||
for g_id in ctx.cache.guilds() {
|
for g_id in ctx.cache.guilds() {
|
||||||
let g = ctx.cache.guild(g_id).expect("Unable to fetch guild");
|
let g = ctx.cache.guild(g_id).expect("Unable to fetch guild");
|
||||||
println!("Initializing {}...", g.name);
|
println!("Initializing {}...", g.name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
36
src/main.rs
36
src/main.rs
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
use std::env;
|
use std::env;
|
||||||
|
|
||||||
|
use serenity::framework::standard::StandardFramework;
|
||||||
use serenity::prelude::*;
|
use serenity::prelude::*;
|
||||||
use serenity::framework::standard::{StandardFramework};
|
|
||||||
|
|
||||||
// This trait adds the `register_songbird` and `register_songbird_with` methods
|
// This trait adds the `register_songbird` and `register_songbird_with` methods
|
||||||
// to the client builder below, making it easy to install this voice client.
|
// to the client builder below, making it easy to install this voice client.
|
||||||
@@ -24,28 +24,26 @@ async fn main() {
|
|||||||
let token = env::var("DISCORD_TOKEN").expect("Expected a token in the environment");
|
let token = env::var("DISCORD_TOKEN").expect("Expected a token in the environment");
|
||||||
// Set gateway intents, which decides what events the bot will be notified about
|
// Set gateway intents, which decides what events the bot will be notified about
|
||||||
let intents = GatewayIntents::GUILD_MESSAGES
|
let intents = GatewayIntents::GUILD_MESSAGES
|
||||||
| GatewayIntents::GUILD_VOICE_STATES
|
| GatewayIntents::GUILD_VOICE_STATES
|
||||||
| GatewayIntents::GUILD_MESSAGE_REACTIONS
|
| GatewayIntents::GUILD_MESSAGE_REACTIONS
|
||||||
| GatewayIntents::GUILD_MESSAGE_TYPING
|
| GatewayIntents::GUILD_MESSAGE_TYPING
|
||||||
| GatewayIntents::DIRECT_MESSAGES
|
| GatewayIntents::DIRECT_MESSAGES
|
||||||
| GatewayIntents::DIRECT_MESSAGE_REACTIONS
|
| GatewayIntents::DIRECT_MESSAGE_REACTIONS
|
||||||
| GatewayIntents::DIRECT_MESSAGE_TYPING
|
| GatewayIntents::DIRECT_MESSAGE_TYPING
|
||||||
| GatewayIntents::MESSAGE_CONTENT;
|
| GatewayIntents::MESSAGE_CONTENT;
|
||||||
|
|
||||||
let framework = StandardFramework::new()
|
let framework = StandardFramework::new()
|
||||||
.configure(|c| c.prefix("ALAN! "))
|
.configure(|c| c.prefix("ALAN! "))
|
||||||
.group(&GENERAL_GROUP);
|
.group(&GENERAL_GROUP);
|
||||||
|
|
||||||
let mut client =
|
let mut client = Client::builder(&token, intents)
|
||||||
Client::builder(&token, intents)
|
.event_handler(Handler)
|
||||||
.event_handler(Handler)
|
.framework(framework)
|
||||||
.framework(framework)
|
.register_songbird()
|
||||||
.register_songbird()
|
.await
|
||||||
.await.expect("Err creating client");
|
.expect("Err creating client");
|
||||||
|
|
||||||
if let Err(why) = client.start().await {
|
if let Err(why) = client.start().await {
|
||||||
println!("Client error: {:?} <-- This is a test clause -->", why);
|
println!("Client error: {:?}", why);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user