update reaction role test code

main
Joey Pollack 2 years ago
parent 9cd32f5fa9
commit d527020d3d

@ -103,14 +103,17 @@ pub async fn handle_reaction_add(ctx: Context, reaction: Reaction)
{ {
if reaction.emoji.unicode_eq("👍") if reaction.emoji.unicode_eq("👍")
{ {
utils::add_role(ctx, reaction.user_id.expect("UserId was None in handle_reaction_add"), let user_name = reaction.user(ctx.clone()).await.unwrap().name;
utils::add_role(ctx.clone(), reaction.user_id.expect("UserId was None in handle_reaction_add"),
RoleId::from(ROLE_ID_ANY_PERCENT), RoleId::from(ROLE_ID_ANY_PERCENT),
reaction.guild_id.expect("GuildId was None in handle_reaction_add")) reaction.guild_id.expect("GuildId was None in handle_reaction_add"))
.await.unwrap(); .await.unwrap();
utils::Logger::log_message(ctx.clone(), &format!("Added any% role for {}", user_name)).await;
} }
else else
{ {
utils::Logger::log_message(ctx, "Reaction was not the thumbs up emoji").await; utils::Logger::log_message(ctx.clone(), "Reaction was not the thumbs up emoji").await;
} }
} }
} }

@ -46,7 +46,7 @@ impl EventHandler for Handler
async fn reaction_add(&self, ctx: Context, add_reaction: Reaction) async fn reaction_add(&self, ctx: Context, add_reaction: Reaction)
{ {
// println!("reaction_add event"); println!("reaction_add event");
//utils::Logger::log_message(ctx, &format!("reaction add event: {:#?}", add_reaction)).await; //utils::Logger::log_message(ctx, &format!("reaction add event: {:#?}", add_reaction)).await;
// todo!() // todo!()
@ -56,7 +56,7 @@ impl EventHandler for Handler
async fn reaction_remove(&self, ctx: Context, removed_reaction: Reaction) async fn reaction_remove(&self, ctx: Context, removed_reaction: Reaction)
{ {
println!("reaction_remove event"); println!("reaction_remove event");
utils::Logger::log_message(ctx, &format!("reaction removed event: {:#?}", removed_reaction)).await; //utils::Logger::log_message(ctx, &format!("reaction removed event: {:#?}", removed_reaction)).await;
} }
// Set a handler to be called on the `ready` event. This is called when a // Set a handler to be called on the `ready` event. This is called when a

Loading…
Cancel
Save