This commit is contained in:
Gzod01 2024-06-14 10:20:09 +02:00
parent 9c386b0ffa
commit 53c9f205fe
2 changed files with 15 additions and 4 deletions

BIN
core

Binary file not shown.

View file

@ -6,7 +6,7 @@ use std::fs::File;
use std::io::Read; use std::io::Read;
// use lazy_static::lazy_static; // 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::{async_trait, json};
use serenity::model::channel::Message; use serenity::model::channel::Message;
use serenity::model::event::Event; use serenity::model::event::Event;
@ -55,16 +55,27 @@ impl EventHandler for Handler {
println!("unknown command {command_with_exclam:?}"); println!("unknown command {command_with_exclam:?}");
} }
} }
if ["hello", "hi", "bonjour", "hola", "halo"] /*if ["hello", "hi", "bonjour", "hola", "halo"]
.iter() .iter()
.any(|&s| msg.content.to_lowercase().contains(s)) .any(|&s| msg.content.to_lowercase().contains(s))
{ {
if let Err(why) = msg.react(ctx, '👋').await { if let Err(why) = msg.react(ctx, '👋').await {
println!("Error reacting message {why:?}"); println!("Error reacting message {why:?}");
} }
}*/
}
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 guild_m }
async fn interaction_create(&self, ctx: Context, interaction: Interaction){ async fn interaction_create(&self, ctx: Context, interaction: Interaction){
if let Interaction::Component(comp) = interaction{ if let Interaction::Component(comp) = interaction{