Skip to content

Commit

Permalink
refactor emoji strings
Browse files Browse the repository at this point in the history
  • Loading branch information
shadmansakib authored and sakibstark11 committed Jan 10, 2024
1 parent b5a6779 commit 6b9f423
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
3 changes: 3 additions & 0 deletions src/emojis.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,6 @@
NUMBERS = ":1234:"
MAN_SHRUGGING = ":man_shrugging:"
CRY = ":cry:"
HEART = ":heart:"
PLEADING_FACE = ":pleading_face:"
STAR_STRUCK = ":star_struck:"
12 changes: 6 additions & 6 deletions src/handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@ def gem_handler(body: Dict[str, Any], env_vars):
if has_receiver_opted_out(gems_message.receiver_discord_id):
receiver = gems_message.receiver_username if hasattr(gems_message, 'receiver_username') else 'Recipient'
return slash_command_response(f"""
**:pleading_face: {receiver} has chosen solitude and is temporarily not receiving any gems.
Thank you for the acknowledgment, by the way :heart:**
**{emojis.PLEADING_FACE} {receiver} has chosen solitude and is temporarily not receiving any gems.
Thank you for the acknowledgment, by the way {emojis.HEART}**
""")

if gems_message.sender_discord_id == gems_message.receiver_discord_id:
Expand Down Expand Up @@ -165,18 +165,18 @@ def self_gem(gems_message: GemsMessage):
def handle_opt_out(user_discord_id: str):
"""Opt-out user from receiving gems"""
if has_receiver_opted_out(user_discord_id):
return slash_command_response(f"**:pleading_face: You are already opted out**")
return slash_command_response(f"**{emojis.PLEADING_FACE} You are already opted out.**")
expire_on = insert_opt_out(user_discord_id)
expire_on_readable = datetime.datetime.fromtimestamp(expire_on).strftime('%d-%m-%Y')
return slash_command_response(f"**:pleading_face: You have successfully opted out of receiving gems, effective until {expire_on_readable}**")
return slash_command_response(f"**{emojis.PLEADING_FACE} You have successfully opted out of receiving gems, effective until {expire_on_readable}.**")


def handle_opt_in(user_discord_id: str):
"""Opt-in again"""
if has_receiver_opted_out(user_discord_id):
remove_opt_out(user_discord_id)
return slash_command_response("**:star_struck: You have successfully opted in to receive gems**")
return slash_command_response(f"**:star_struck: You are already opted in**")
return slash_command_response(f"**{emojis.STAR_STRUCK} You have successfully opted in to receive gems**")
return slash_command_response(f"**{emojis.STAR_STRUCK} You are already opted in**")


def handle_rank_command():
Expand Down

0 comments on commit 6b9f423

Please sign in to comment.