Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions Domains/cli/MiniProjects/MoodLift/README.MD
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# MoodLift: Employee Stress Relief Jokes

A cheerful CLI tool that fetches a random joke to brighten your workday and melt away coding stress!

## Features
- Fetches real jokes from a public API
- Colorful, boxed display in terminal
- Zero dependencies (uses only Python standard library)
- Instant mood boost for developers 😄

## How to Run
1. Ensure you have Python 3 installed.
2. Navigate to this folder:
```bash
cd Domains/CLI/MiniProjects/MoodLift
32 changes: 32 additions & 0 deletions Domains/cli/MiniProjects/MoodLift/moodlift.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import urllib.request
import json
import random

def print_fancy_box(joke_setup, punchline):
"""Print joke in a decorative box."""
width = max(len(joke_setup), len(punchline)) + 4
border = "+" + "-" * (width) + "+"

print("\n\033[96m" + border + "\033[0m")
print("\033[93m| " + joke_setup.ljust(width - 2) + " |\033[0m")
print("\033[93m| " + punchline.ljust(width - 2) + " |\033[0m")
print("\033[96m" + border + "\033[0m\n")

def get_random_joke():
"""Fetch a random joke from the public API."""
try:
with urllib.request.urlopen("https://official-joke-api.appspot.com/random_joke") as response:
data = json.loads(response.read().decode())
return data["setup"], data["punchline"]
except Exception as e:
return "Feeling stressed? Take a deep breath!", "Even APIs need coffee sometimes. 😅"

def main():
print("\033[1;92m✨ MoodLift: Your Daily Dose of Desk-side Joy ✨\033[0m")
print("\033[90m(For when the code won't compile and the coffee's cold...)\033[0m\n")

setup, punchline = get_random_joke()
print_fancy_box(setup, punchline)

if __name__ == "__main__":
main()
Loading