|
|
|
|
@ -1,10 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#![allow(dead_code)]
|
|
|
|
|
|
|
|
|
|
use serenity::prelude::*;
|
|
|
|
|
use serenity::model::prelude::*;
|
|
|
|
|
use serenity::model::channel::Message;
|
|
|
|
|
|
|
|
|
|
use crate::{utils, Owner};
|
|
|
|
|
|
|
|
|
|
// TODO: ADD REACTION ROLE MESSAGE IDS HERE
|
|
|
|
|
|
|
|
|
|
// AUTHORIZED USER IDS:
|
|
|
|
|
const BEL_WORK_USER_ID: u64 = 474259726427750420;
|
|
|
|
|
@ -49,6 +53,7 @@ pub async fn parse_command(ctx: Context, msg: Message, server_id: GuildId)
|
|
|
|
|
None => { utils::Logger::log_error(ctx.clone(), &format!("Couldn't get bot owner id")).await; return; }
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// TODO: Modify this to post the real Reaction Roles message
|
|
|
|
|
if (UserId::from(owner_id) == msg.author.id || UserId::from(BEL_WORK_USER_ID) == msg.author.id) && command_start == Some(".dotestmsg")
|
|
|
|
|
{
|
|
|
|
|
if let Some(msg) = utils::send_msg(ctx.clone(), ChannelId::from(SM_TEST_CHANNEL_ID), "Test message!").await
|
|
|
|
|
@ -98,6 +103,7 @@ pub async fn parse_command(ctx: Context, msg: Message, server_id: GuildId)
|
|
|
|
|
|
|
|
|
|
pub async fn handle_reaction_add(ctx: Context, reaction: Reaction)
|
|
|
|
|
{
|
|
|
|
|
// TODO: Modify to handle the real reaction roles message for all race roles
|
|
|
|
|
if reaction.channel_id == ChannelId::from(SM_TEST_CHANNEL_ID)
|
|
|
|
|
&& reaction.message_id == MessageId::from(1245086205381574790 as u64)
|
|
|
|
|
{
|
|
|
|
|
@ -111,24 +117,29 @@ pub async fn handle_reaction_add(ctx: Context, reaction: Reaction)
|
|
|
|
|
|
|
|
|
|
utils::Logger::log_message(ctx.clone(), &format!("Added any% role for {}", user_name)).await;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
utils::Logger::log_message(ctx.clone(), "Reaction was not the thumbs up emoji").await;
|
|
|
|
|
}
|
|
|
|
|
// else
|
|
|
|
|
// {
|
|
|
|
|
// utils::Logger::log_message(ctx.clone(), "Reaction was not the thumbs up emoji").await;
|
|
|
|
|
// }
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pub async fn handle_reaction_remove(ctx: Context, reaction: Reaction)
|
|
|
|
|
{
|
|
|
|
|
// TODO: Modify to handle the real reaction roles message for all race roles
|
|
|
|
|
if reaction.channel_id == ChannelId::from(SM_TEST_CHANNEL_ID)
|
|
|
|
|
&& reaction.message_id == MessageId::from(1245086205381574790 as u64)
|
|
|
|
|
{
|
|
|
|
|
if reaction.emoji.unicode_eq("👍")
|
|
|
|
|
{
|
|
|
|
|
utils::remove_role(ctx, reaction.user_id.expect("UserId was None in handle_reaction_remove"),
|
|
|
|
|
utils::remove_role(ctx.clone(), reaction.user_id.expect("UserId was None in handle_reaction_remove"),
|
|
|
|
|
RoleId::from(ROLE_ID_ANY_PERCENT),
|
|
|
|
|
reaction.guild_id.expect("GuildId was None in handle_reaction_remove"))
|
|
|
|
|
.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;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
|