|
|
|
@ -34,6 +34,12 @@ const ROLE_ID_BINGO: u64 = 621128130681110546;
|
|
|
|
const ROLE_ID_MISC: u64 = 313710318486421505;
|
|
|
|
const ROLE_ID_MISC: u64 = 313710318486421505;
|
|
|
|
const ROLE_ID_PUZZLE: u64 = 405792833820164102;
|
|
|
|
const ROLE_ID_PUZZLE: u64 = 405792833820164102;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// ROLE EMOJIS:
|
|
|
|
|
|
|
|
const EMOJI_SM_ID: u64 = 245980377867485184;
|
|
|
|
|
|
|
|
const EMOJI_HUNDO_ID: u64 = 1023763860680876132;
|
|
|
|
|
|
|
|
const EMOJI_CROCZ_ID: u64 = 243881344910753794;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pub async fn parse_command(ctx: Context, msg: Message, server_id: GuildId)
|
|
|
|
pub async fn parse_command(ctx: Context, msg: Message, server_id: GuildId)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
@ -59,7 +65,7 @@ pub async fn parse_command(ctx: Context, msg: Message, server_id: GuildId)
|
|
|
|
command_start == Some(".dorolesmsg")
|
|
|
|
command_start == Some(".dorolesmsg")
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if let Some(msg) = utils::send_msg(ctx.clone(),
|
|
|
|
if let Some(msg) = utils::send_msg(ctx.clone(),
|
|
|
|
ChannelId::from(SM_TEST_CHANNEL_ID), "Test message!").await
|
|
|
|
ChannelId::from(SM_TEST_CHANNEL_ID), "Test message! :CrocZ:").await
|
|
|
|
{
|
|
|
|
{
|
|
|
|
println!("Test message id is: {:#?}", msg.id)
|
|
|
|
println!("Test message id is: {:#?}", msg.id)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -110,15 +116,46 @@ pub async fn handle_reaction_add(ctx: Context, reaction: Reaction)
|
|
|
|
if reaction.channel_id == ChannelId::from(SM_TEST_CHANNEL_ID)
|
|
|
|
if reaction.channel_id == ChannelId::from(SM_TEST_CHANNEL_ID)
|
|
|
|
&& reaction.message_id == MessageId::from(1245086205381574790 as u64)
|
|
|
|
&& reaction.message_id == MessageId::from(1245086205381574790 as u64)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if reaction.emoji.unicode_eq("👍")
|
|
|
|
if let ReactionType::Custom{ animated: _, id, name: _ } = reaction.clone().emoji
|
|
|
|
{
|
|
|
|
{
|
|
|
|
let user_name = reaction.user(ctx.clone()).await.unwrap().name;
|
|
|
|
match id
|
|
|
|
utils::add_role(ctx.clone(), reaction.user_id.expect("UserId was None in handle_reaction_add"),
|
|
|
|
{
|
|
|
|
RoleId::from(ROLE_ID_ANY_PERCENT),
|
|
|
|
EmojiId(EMOJI_SM_ID) => {
|
|
|
|
reaction.guild_id.expect("GuildId was None in handle_reaction_add"))
|
|
|
|
utils::add_role(ctx.clone(), reaction.user_id.expect("UserId was None in handle_reaction_add"),
|
|
|
|
.await.unwrap();
|
|
|
|
RoleId::from(ROLE_ID_ANY_PERCENT),
|
|
|
|
|
|
|
|
reaction.guild_id.expect("GuildId was None in handle_reaction_add"))
|
|
|
|
|
|
|
|
.await.unwrap();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let user_name = reaction.user(ctx.clone()).await.unwrap().name;
|
|
|
|
|
|
|
|
utils::Logger::log_message(ctx.clone(), &format!("Added any% role for {}", user_name)).await;
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
EmojiId(EMOJI_HUNDO_ID) => {
|
|
|
|
|
|
|
|
utils::add_role(ctx.clone(), reaction.user_id.expect("UserId was None in handle_reaction_add"),
|
|
|
|
|
|
|
|
RoleId::from(ROLE_ID_HUNDO),
|
|
|
|
|
|
|
|
reaction.guild_id.expect("GuildId was None in handle_reaction_add"))
|
|
|
|
|
|
|
|
.await.unwrap();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let user_name = reaction.user(ctx.clone()).await.unwrap().name;
|
|
|
|
|
|
|
|
utils::Logger::log_message(ctx.clone(), &format!("Added hundo role for {}", user_name)).await;
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
EmojiId(EMOJI_CROCZ_ID) => {
|
|
|
|
|
|
|
|
utils::add_role(ctx.clone(), reaction.user_id.expect("UserId was None in handle_reaction_add"),
|
|
|
|
|
|
|
|
RoleId::from(ROLE_ID_RANDOMIZER),
|
|
|
|
|
|
|
|
reaction.guild_id.expect("GuildId was None in handle_reaction_add"))
|
|
|
|
|
|
|
|
.await.unwrap();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let user_name = reaction.user(ctx.clone()).await.unwrap().name;
|
|
|
|
|
|
|
|
utils::Logger::log_message(ctx.clone(), &format!("Added randomizer role for {}", user_name)).await;
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// COLORS
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
utils::Logger::log_message(ctx.clone(), &format!("Added any% role for {}", user_name)).await;
|
|
|
|
_ => (), // TODO: Maybe give (or log) an error?
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// else
|
|
|
|
// else
|
|
|
|
// {
|
|
|
|
// {
|
|
|
|
@ -133,16 +170,48 @@ pub async fn handle_reaction_remove(ctx: Context, reaction: Reaction)
|
|
|
|
if reaction.channel_id == ChannelId::from(SM_TEST_CHANNEL_ID)
|
|
|
|
if reaction.channel_id == ChannelId::from(SM_TEST_CHANNEL_ID)
|
|
|
|
&& reaction.message_id == MessageId::from(1245086205381574790 as u64)
|
|
|
|
&& reaction.message_id == MessageId::from(1245086205381574790 as u64)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if reaction.emoji.unicode_eq("👍")
|
|
|
|
if let ReactionType::Custom{ animated: _, id, name: _ } = reaction.clone().emoji
|
|
|
|
{
|
|
|
|
{
|
|
|
|
utils::remove_role(ctx.clone(), reaction.user_id.expect("UserId was None in handle_reaction_remove"),
|
|
|
|
match id
|
|
|
|
RoleId::from(ROLE_ID_ANY_PERCENT),
|
|
|
|
{
|
|
|
|
reaction.guild_id.expect("GuildId was None in handle_reaction_remove"))
|
|
|
|
EmojiId(EMOJI_SM_ID) => {
|
|
|
|
.await.unwrap();
|
|
|
|
utils::remove_role(ctx.clone(), reaction.user_id.expect("UserId was None in handle_reaction_add"),
|
|
|
|
|
|
|
|
RoleId::from(ROLE_ID_ANY_PERCENT),
|
|
|
|
|
|
|
|
reaction.guild_id.expect("GuildId was None in handle_reaction_add"))
|
|
|
|
|
|
|
|
.await.unwrap();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let user_name = reaction.user(ctx.clone()).await.unwrap().name;
|
|
|
|
|
|
|
|
utils::Logger::log_message(ctx.clone(), &format!("Removed any% role for {}", user_name)).await;
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
EmojiId(EMOJI_HUNDO_ID) => {
|
|
|
|
|
|
|
|
utils::remove_role(ctx.clone(), reaction.user_id.expect("UserId was None in handle_reaction_add"),
|
|
|
|
|
|
|
|
RoleId::from(ROLE_ID_HUNDO),
|
|
|
|
|
|
|
|
reaction.guild_id.expect("GuildId was None in handle_reaction_add"))
|
|
|
|
|
|
|
|
.await.unwrap();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let user_name = reaction.user(ctx.clone()).await.unwrap().name;
|
|
|
|
|
|
|
|
utils::Logger::log_message(ctx.clone(), &format!("Removed hundo role for {}", user_name)).await;
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
EmojiId(EMOJI_CROCZ_ID) => {
|
|
|
|
|
|
|
|
utils::remove_role(ctx.clone(), reaction.user_id.expect("UserId was None in handle_reaction_add"),
|
|
|
|
|
|
|
|
RoleId::from(ROLE_ID_RANDOMIZER),
|
|
|
|
|
|
|
|
reaction.guild_id.expect("GuildId was None in handle_reaction_add"))
|
|
|
|
|
|
|
|
.await.unwrap();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let user_name = reaction.user(ctx.clone()).await.unwrap().name;
|
|
|
|
|
|
|
|
utils::Logger::log_message(ctx.clone(), &format!("Removed randomizer role for {}", user_name)).await;
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// COLORS
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_ => (), // TODO: Maybe give (or log) an error?
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let user_name = reaction.user(ctx.clone()).await.unwrap().name;
|
|
|
|
|
|
|
|
utils::Logger::log_message(ctx.clone(), &format!("Removed any% role for {}", user_name)).await;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|