diff --git a/config.ini.example b/config.ini.example index ee8a965..322a304 100644 --- a/config.ini.example +++ b/config.ini.example @@ -50,6 +50,11 @@ rate_limit_seconds = 10 # Prevents bot from overwhelming the mesh network bot_tx_rate_limit_seconds = 1.0 +# Timezone for bot operations +# Use standard timezone names (e.g., "America/New_York", "Europe/London", "UTC") +# Leave empty to use system timezone +timezone = + # Send startup advert when bot finishes initializing # false: No startup advert (default) # zero-hop: Send local broadcast advert diff --git a/modules/commands/hello_command.py b/modules/commands/hello_command.py index ed969d7..9c29841 100644 --- a/modules/commands/hello_command.py +++ b/modules/commands/hello_command.py @@ -14,29 +14,70 @@ class HelloCommand(BaseCommand): # Plugin metadata name = "hello" - keywords = ['hello', 'hi', 'hey', 'howdy', 'greetings', 'salutations'] + keywords = ['hello', 'hi', 'hey', 'howdy', 'greetings', 'salutations', 'good morning', 'good afternoon', 'good evening', 'good night', 'yo', 'sup', 'whats up', 'what\'s up', 'morning', 'afternoon', 'evening', 'night', 'gday', 'g\'day', 'hola', 'bonjour', 'ciao', 'namaste', 'aloha', 'shalom', 'konnichiwa', 'guten tag', 'buenos dias', 'buenas tardes', 'buenas noches'] description = "Responds to greetings with robot-themed responses" category = "basic" def __init__(self, bot): super().__init__(bot) - # Robot greetings from popular culture - self.robot_greetings = [ - "Greetings, human!", - "Hello, meatbag!", - "Salutations, carbon-based lifeform!", - "Greetings, organic entity!", - "Hello, biological unit!", - "Salutations, flesh creature!", - "Greetings, meat-based organism!", - "Hello, carbon unit!", - "Salutations, organic being!", - "Greetings, biological entity!", - "Hello, meat-based lifeform!", - "Salutations, carbon creature!", - "Greetings, flesh unit!", - "Hello, organic organism!", - "Salutations, biological creature!" + + # Time-neutral greeting openings + self.greeting_openings = [ + "Hello", "Greetings", "Salutations", "Hi", "Hey", "Howdy", "Yo", "Sup", + "What's up", "Good day", "Well met", "Hail", "Ahoy", "Bonjour", "Hola", + "Ciao", "Namaste", "Aloha", "Shalom", "Konnichiwa", "Guten tag", "G'day", + "How goes it", "What's good", "Peace", "Respect", "Blessings", "Cheers", + "Welcome", "Nice to see you", "Pleasure to meet you", "Good to see you", + "Long time no see", "Fancy meeting you here" + ] + + # Time-based greeting openings + self.morning_greetings = [ + "Good morning", "Top o' the morning", "Buenos dias", "Bonjour", + "Guten morgen", "Buongiorno", "Bom dia", "Dobro jutro", "Dobroye utro", + "Selamat pagi", "Ohayou gozaimasu", "Sabah al-khair", "Boker tov" + ] + + self.afternoon_greetings = [ + "Good afternoon", "Buenas tardes", "Boa tarde", "Dobro dan", + "Dobryy den", "Selamat siang", "Konnichiwa", "Ahlan bi-nahar", + "Tzoharaim tovim" + ] + + self.evening_greetings = [ + "Good evening", "Buenas noches", "Boa noite", "Dobro veče", + "Dobryy vecher", "Selamat malam", "Konbanwa", "Ahlan bi-layl", + "Erev tov" + ] + + # Randomized human descriptors + self.human_descriptors = [ + # Classic robot references + "human", "carbon-based lifeform", "organic entity", "biological unit", + "flesh creature", "meat-based organism", "carbon unit", "organic being", + "biological entity", "meat-based lifeform", "carbon creature", "flesh unit", + "organic organism", "biological creature", "meat mech", "flesh bot", "organic automaton", + "biological android", "carbon construct", "flesh drone", "organic robot", + "biological machine", "meat cyborg", "flesh android", "organic droid", "biological bot", + "carbon android", "meat unit", "flesh construct", "organic mech", "biological droid", + "meat-based bot", "flesh-based unit", "organic-based entity", "biological-based organism", + "carbon-based unit", "meat-based entity", "flesh-based creature", "organic-based unit", + + # Scientific/technical + "DNA-based lifeform", "neural network user", "bipedal mammal", + "water-based organism", "protein assembler", "ATP consumer", + "cellular automaton", "genetic algorithm", "biochemical processor", + "metabolic engine", "neural pathway", + + # Friendly and approachable + "human friend", "fellow sentient being", "earthling", "fellow traveler", + "kindred spirit", "digital companion", "friend", "buddy", "pal", "mate", + "fellow human", "earth dweller", "terrestrial being", "planet walker", + + # Playful and humorous + "humanoid", "organic", "biological", "carbon-based buddy", + "flesh-based friend", "organic pal", "biological buddy", "carbon companion", + "carbon sack", "organic pipe" ] def get_help_text(self) -> str: @@ -52,5 +93,47 @@ class HelloCommand(BaseCommand): return await self.send_response(message, response) def get_random_greeting(self) -> str: - """Get a random robot greeting""" - return random.choice(self.robot_greetings) + """Generate a random robot greeting by combining opening and descriptor""" + import datetime + import pytz + + # Get configured timezone or use system timezone + timezone_str = self.bot.config.get('Bot', 'timezone', fallback='') + + if timezone_str: + try: + # Use configured timezone + tz = pytz.timezone(timezone_str) + current_time = datetime.datetime.now(tz) + except pytz.exceptions.UnknownTimeZoneError: + # Fallback to system timezone if configured timezone is invalid + current_time = datetime.datetime.now() + else: + # Use system timezone + current_time = datetime.datetime.now() + + # Get current hour to determine time of day + current_hour = current_time.hour + + # Choose appropriate greeting based on time of day + if 5 <= current_hour < 12: # Morning (5 AM - 12 PM) + greeting_pool = self.morning_greetings + self.greeting_openings + elif 12 <= current_hour < 17: # Afternoon (12 PM - 5 PM) + greeting_pool = self.afternoon_greetings + self.greeting_openings + elif 17 <= current_hour < 22: # Evening (5 PM - 10 PM) + greeting_pool = self.evening_greetings + self.greeting_openings + else: # Night/Late night (10 PM - 5 AM) + greeting_pool = self.evening_greetings + self.greeting_openings + + opening = random.choice(greeting_pool) + descriptor = random.choice(self.human_descriptors) + + # Add some variety in punctuation and formatting + punctuation_options = ["!", ".", "!", "!", "!"] # Favor exclamation marks + punctuation = random.choice(punctuation_options) + + # Sometimes add a comma, sometimes not + if random.choice([True, False]): + return f"{opening}, {descriptor}{punctuation}" + else: + return f"{opening} {descriptor}{punctuation}" diff --git a/modules/core.py b/modules/core.py index 322e386..8b644cf 100644 --- a/modules/core.py +++ b/modules/core.py @@ -148,6 +148,11 @@ rate_limit_seconds = 2 # Prevents bot from overwhelming the mesh network bot_tx_rate_limit_seconds = 1.0 +# Timezone for bot operations +# Use standard timezone names (e.g., "America/New_York", "Europe/London", "UTC") +# Leave empty to use system timezone +timezone = + # Send startup advert when bot finishes initializing # false: No startup advert (default) # zero-hop: Send local broadcast advert diff --git a/requirements.txt b/requirements.txt index c559804..abc126b 100644 --- a/requirements.txt +++ b/requirements.txt @@ -9,3 +9,4 @@ requests>=2.31.0 pyephem>=4.1.4 geopy>=2.3.0 maidenhead>=1.4.0 +pytz>=2023.3