mirror of
https://github.com/agessaman/meshcore-bot.git
synced 2026-04-01 04:55:40 +00:00
- Enhanced command processing with exclamation mark handling - Improved message handling and RF data correlation - Updated repeater management functionality - Enhanced command implementations across all modules - Updated database manager and core functionality - All changes maintain backward compatibility
57 lines
1.9 KiB
Python
57 lines
1.9 KiB
Python
#!/usr/bin/env python3
|
|
"""
|
|
Hello command for the MeshCore Bot
|
|
Responds to various greetings with robot-themed responses
|
|
"""
|
|
|
|
import random
|
|
from .base_command import BaseCommand
|
|
from ..models import MeshMessage
|
|
|
|
|
|
class HelloCommand(BaseCommand):
|
|
"""Handles various greeting commands"""
|
|
|
|
# Plugin metadata
|
|
name = "hello"
|
|
keywords = ['hello', 'hi', 'hey', 'howdy', 'greetings', 'salutations']
|
|
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!"
|
|
]
|
|
|
|
def get_help_text(self) -> str:
|
|
return self.description
|
|
|
|
async def execute(self, message: MeshMessage) -> bool:
|
|
"""Execute the hello command"""
|
|
# Get bot name from config
|
|
bot_name = self.bot.config.get('Bot', 'bot_name', fallback='Bot')
|
|
# Get random robot greeting
|
|
random_greeting = self.get_random_greeting()
|
|
response = f"{random_greeting} I'm {bot_name}."
|
|
return await self.send_response(message, response)
|
|
|
|
def get_random_greeting(self) -> str:
|
|
"""Get a random robot greeting"""
|
|
return random.choice(self.robot_greetings)
|