Add rudimentary support for role assignment via reactions
This commit is contained in:
parent
0fbefe2b30
commit
1ee9233e05
|
@ -1 +1,2 @@
|
||||||
/target
|
/target
|
||||||
|
secret
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
33
src/main.rs
33
src/main.rs
|
@ -6,6 +6,7 @@ use serenity::framework::standard::{
|
||||||
macros::{command, group},
|
macros::{command, group},
|
||||||
CommandResult, StandardFramework,
|
CommandResult, StandardFramework,
|
||||||
};
|
};
|
||||||
|
use serenity::model::channel::{Reaction, ReactionType};
|
||||||
use serenity::model::{
|
use serenity::model::{
|
||||||
channel::Message,
|
channel::Message,
|
||||||
id::{ChannelId, GuildId, UserId},
|
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> {
|
fn read_token() -> io::Result<String> {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user