jarvis-cloud / modules /bedtime.py
Jarvis2345's picture
Upload folder using huggingface_hub
01ab0a4 verified
Raw
History Blame Contribute Delete
3.16 kB
"""
modules/bedtime.py β€” FRIDAY Bedtime Companion
Sleep stories, meditation, wind-down:
- Sleep stories
- Meditation guidance
- Calming sounds
- Sleep tips
"""
import random
# Sleep Tips
SLEEP_TIPS = [
"No screens 1 hour before bed.",
"Cool room, warm bed.",
"Light reading, not screens.",
"4-7-8 breathing: inhale 4, hold 7, exhale 8.",
"Gratitude journaling calms the mind.",
"Ambient sound helps sleep.",
"Consistent bedtime = better sleep.",
]
# Calming Stories (Short)
STORIES = [
"You find yourself in a peaceful forest. The trees whisper calm. You walk slowly, breathing in nature. Every step takes you deeper into peace. The forest holds you gently...",
"You're floating on a calm cloud. Soft, white, warm. No worries. Just floating. The cloud carries you gently to dreamland...",
"A gentle wave laps at your feet. You're on a quiet beach. The sound is soothing. Each wave washes away tension. You breathe with the ocean...",
"You find a mountain stream. Cool, clear water. You cup your hands and drink. The water flows through you, washing clean. Peace flows too...",
"You're in a garden at twilight. Fireflies glow softly. The air is warm and sweet. You breathe in peace with each firefly blink. The garden wraps you in calm...",
]
def sleep_tip() -> str:
"""Get sleep tip."""
return random.choice(SLEEP_TIPS)
def sleep_story() -> str:
"""Get sleep story."""
return random.choice(STORIES)
def breathing_exercise() -> str:
"""Get breathing exercise."""
return "4-7-8 breathing: Inhale 4 seconds, Hold 7 seconds, Exhale 8 seconds. Repeat 3 times."
def meditation_guide() -> str:
"""Get meditation guidance."""
return "Close your eyes. Focus on breathing. Clear thoughts. Let them pass like clouds. You are the sky - vast, calm."
# ── Voice Commands ────────────────────────────────────────────
def handle_command(command: str, speak) -> bool:
"""Handle bedtime commands."""
c = command.lower()
# Sleep story
if "bedtime story" in c or "sleep story" in c or "tell me a story" in c:
story = sleep_story()
speak(story[:200] + "... drifting...")
return True
# Meditation
if "meditat" in c or "calm" in c or "slow down" in c:
guide = meditation_guide()
speak(guide)
return True
# Breathing
if "breath" in c or "relax" in c:
exercise = breathing_exercise()
speak(exercise)
return True
# Sleep tip
if "sleep tip" in c or "better sleep" in c or "can't sleep" in c:
tip = sleep_tip()
speak(tip)
return True
# Good night check
if "good night" in c or "goodnight" in c or "bedtime" in c:
import random
greetings = ["Good night, boss. Sweet dreams.", "Sleep tight. I'll watch over things.", "Rest well. I'll be here when you wake."]
speak(random.choice(greetings))
return True
return False