aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/commands/reactionroles.rs2
-rw-r--r--src/handler.rs4
2 files changed, 5 insertions, 1 deletions
diff --git a/src/commands/reactionroles.rs b/src/commands/reactionroles.rs
index 53aa794..eb5f098 100644
--- a/src/commands/reactionroles.rs
+++ b/src/commands/reactionroles.rs
@@ -106,7 +106,7 @@ pub async fn init(ctx: Context<'_>,
if let Some(role) = ctx.guild().unwrap().role_by_name(role_name) {
sqlx::query!("INSERT INTO reaction_roles (channel_id, message_id, guild_id, reaction, role_id) VALUES ($1, $2, $3, $4, $5)", rolemenu_msg.channel_id.0.to_string(), rolemenu_msg.id.0.to_string(), ctx.guild_id().unwrap().0.to_string(), reaction.to_string(), role.id.0.to_string()).execute(&pool).await?;
rolemenu_msg.react(ctx.discord(), reaction.clone()).await?;
- rolelist_formatted.push_str(&format!("{} - {}\n", get_reactiontype_display(&reaction), role.name.clone()));
+ rolelist_formatted.push_str(&format!("{} - <@&{}>\n", get_reactiontype_display(&reaction), role.id.0.clone()));
} else {
ctx.say(format!("Invalid role provided: {}", role_name)).await?;
return Ok(());
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;