Compare commits

..

No commits in common. "35c7c6a02ca1fdc7b52eaa6257c9c0394eb0de9c" and "155121f3406e084292be39f53bd9385ea0ddf20c" have entirely different histories.

4 changed files with 1 additions and 2315 deletions

1
.gitignore vendored
View file

@ -1,2 +1 @@
/target
.env

2273
Cargo.lock generated

File diff suppressed because it is too large Load diff

View file

@ -4,6 +4,3 @@ version = "0.1.0"
edition = "2024"
[dependencies]
serenity = "0.12.5"
tokio = { version = "1.21.2", features = ["macros", "rt-multi-thread"] }
dotenv = "0.15.0"

View file

@ -1,40 +1,3 @@
use std::env;
use dotenv::dotenv;
use serenity::{
all::{Context, EventHandler, GatewayIntents, Message, GATEWAY_VERSION},
async_trait, Client,
};
struct Handler;
#[async_trait]
impl EventHandler for Handler {
async fn message(&self, ctx: Context, msg: Message) {
if msg.content == "!ping" {
println!("found PING!");
if let Err(why) = msg.channel_id.say(&ctx.http, "Pong!").await {
println!("Error sending message: {why:?}");
}
}
}
}
#[tokio::main]
async fn main() {
fn main() {
println!("Hello, world!");
dotenv().ok();
let token = env::var("DISCORD_TOKEN").expect("Expected a token in the environment");
let intens = GatewayIntents::GUILD_MESSAGES
| GatewayIntents::DIRECT_MESSAGES
| GatewayIntents::MESSAGE_CONTENT;
let mut client = Client::builder(&token, intens)
.event_handler(Handler)
.await
.expect("Error creating client");
if let Err(why) = client.start().await {
println!("error: {why:?}");
}
}