diff --git a/core b/core index a206268..0d8a88e 100644 Binary files a/core and b/core differ diff --git a/src/main.rs b/src/main.rs index cdbd128..6ec7b7c 100644 --- a/src/main.rs +++ b/src/main.rs @@ -6,7 +6,7 @@ use std::fs::File; use std::io::Read; // use lazy_static::lazy_static; -use serenity::all::{ComponentInteraction, ComponentInteractionDataKind, CreateInteractionResponse, CreateInteractionResponseMessage, Interaction}; +use serenity::all::{ComponentInteraction, ComponentInteractionDataKind, CreateInteractionResponse, CreateInteractionResponseMessage, Interaction, Member, ChannelId}; use serenity::{async_trait, json}; use serenity::model::channel::Message; use serenity::model::event::Event; @@ -55,16 +55,27 @@ impl EventHandler for Handler { println!("unknown command {command_with_exclam:?}"); } } - if ["hello", "hi", "bonjour", "hola", "halo"] + /*if ["hello", "hi", "bonjour", "hola", "halo"] .iter() .any(|&s| msg.content.to_lowercase().contains(s)) { if let Err(why) = msg.react(ctx, '👋').await { println!("Error reacting message {why:?}"); } - } + }*/ } - async fn guild_m + async fn guild_member_addition(&self, ctx:Context, member:Member){ + if(member.guild_id==311740453009620992){ + let user_id = member.user.id.get(); + let message:String= format!("Hey <@{user_id:?}>, welcome to **FIRST® Global Challenge**:tada:!\ + Don't forget to read rules in <#1237390656918392964> and to tell your country,\ + status and name in <#311817158050971649>! (i.g. team your country, student/mentor, your name)"); + if let Err(why) = ChannelId::new(312262443000659969).say(&ctx.http, message).await{ + println!("Error sending message : {why:?}"); + } + } + } + async fn interaction_create(&self, ctx: Context, interaction: Interaction){ if let Interaction::Component(comp) = interaction{