From 5d9e3781b4030d9896e5bde86ab18da3a3d8ee60 Mon Sep 17 00:00:00 2001 From: Cara Salter Date: Wed, 12 Jan 2022 15:49:26 -0500 Subject: rroles: Fix styling Make the role list have mentions instead of just the role names. Also make the event handler ignore itself. --- src/handler.rs | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/handler.rs') diff --git a/src/handler.rs b/src/handler.rs index 933bd72..ef73f36 100644 --- a/src/handler.rs +++ b/src/handler.rs @@ -11,6 +11,10 @@ pub async fn event_handler(ctx: &serenity::Context, let pool = data.pg.lock().unwrap().clone(); match event { poise::Event::ReactionAdd { add_reaction } => { + let current_user = ctx.http.get_current_user().await?; + if add_reaction.user_id.unwrap() == current_user.id { + return Ok(()); + } let rrole = sqlx::query_as!(ReactionRole, "SELECT * FROM reaction_roles WHERE message_id=$1 AND reaction=$2", add_reaction.message_id.0.to_string(), add_reaction.emoji.to_string()).fetch_one(&pool).await?; let member = ctx.http.get_member(rrole.guild_id.parse::()?, add_reaction.user_id.unwrap().0).await?; let member_roles = member.roles; -- cgit v1.2.3