Please don’t rely on this Gitea instance being around forever. If any of your build scripts use my (kageru’s) projects hosted here, check my Github or IEW on Github for encoding projects. If you can’t find what you’re looking for there, tell me to migrate it.

Add rudimentary support for role assignment via reactions

react
kageru 1 year ago
parent 0fbefe2b30
commit 1ee9233e05
Signed by: kageru
GPG Key ID: 8282A2BEA4ADA3D2

1
.gitignore vendored

@ -1 +1,2 @@
/target
secret

1563
Cargo.lock generated

File diff suppressed because it is too large Load Diff

@ -6,6 +6,7 @@ use serenity::framework::standard::{
macros::{command, group},
CommandResult, StandardFramework,
};
use serenity::model::channel::{Reaction, ReactionType};
use serenity::model::{
channel::Message,
id::{ChannelId, GuildId, UserId},
@ -47,6 +48,38 @@ impl EventHandler for Handler {
});
}
}
async fn reaction_add(&self, ctx: Context, reaction: Reaction) {
if reaction.message_id == 911630315376738384
&& reaction.emoji == ReactionType::Unicode(String::from("🧪"))
{
reaction
.guild_id
.unwrap()
.member(&ctx, reaction.user_id.unwrap())
.await
.unwrap()
.add_role(&ctx, 356421827708321795)
.await
.unwrap()
}
}
async fn reaction_remove(&self, ctx: Context, reaction: Reaction) {
if reaction.message_id == 911630315376738384
&& reaction.emoji == ReactionType::Unicode(String::from("🧪"))
{
reaction
.guild_id
.unwrap()
.member(&ctx, reaction.user_id.unwrap())
.await
.unwrap()
.remove_role(&ctx, 356421827708321795)
.await
.unwrap()
}
}
}
fn read_token() -> io::Result<String> {

Loading…
Cancel
Save