diff options
author | Cara Salter <cara@devcara.com> | 2022-01-12 15:49:26 -0500 |
---|---|---|
committer | Cara Salter <cara@devcara.com> | 2022-01-12 15:49:26 -0500 |
commit | 5d9e3781b4030d9896e5bde86ab18da3a3d8ee60 (patch) | |
tree | 38eb4b61878e50de4fcd7e64b801727d10dcca88 /src/handler.rs | |
parent | 67e4081aa69f489ad88ee064402d68a5969069c2 (diff) | |
download | glitch-ng-5d9e3781b4030d9896e5bde86ab18da3a3d8ee60.tar.gz glitch-ng-5d9e3781b4030d9896e5bde86ab18da3a3d8ee60.zip |
rroles: Fix styling
Make the role list have mentions instead of just the role names. Also
make the event handler ignore itself.
Diffstat (limited to 'src/handler.rs')
-rw-r--r-- | src/handler.rs | 4 |
1 files changed, 4 insertions, 0 deletions
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::<u64>()?, add_reaction.user_id.unwrap().0).await?; let member_roles = member.roles; |