From e0df11724f63f2ec4bff1789762be1fc191e49ce Mon Sep 17 00:00:00 2001 From: agessaman Date: Fri, 14 Nov 2025 18:40:25 -0800 Subject: [PATCH] update path command to have an optional p shortcut, enabled via config.ini; updated catfacts to have more and more accurate facts. --- config.ini.example | 5 ++ modules/commands/catfact_command.py | 94 +++++++++++++++++++---------- modules/commands/path_command.py | 19 +++++- 3 files changed, 83 insertions(+), 35 deletions(-) diff --git a/config.ini.example b/config.ini.example index 2a0cddb..b35599b 100644 --- a/config.ini.example +++ b/config.ini.example @@ -447,6 +447,11 @@ medium_confidence_symbol = ๐Ÿ“ # Low confidence (< 0.8): Shows when path decoding has uncertainty low_confidence_symbol = โ“ +# Enable "p" shortcut for path command (similar to "t" for test command) +# true: Respond to just "p" or "p " as a shortcut for "path" +# false: Only respond to "path", "decode", or "route" keywords (default) +enable_p_shortcut = false + [Hacker] # Enable or disable the hacker command # true: Hacker command is available (responds to Linux commands with supervillain mainframe errors) diff --git a/modules/commands/catfact_command.py b/modules/commands/catfact_command.py index b2dae0b..ef99382 100644 --- a/modules/commands/catfact_command.py +++ b/modules/commands/catfact_command.py @@ -27,46 +27,74 @@ class CatfactCommand(BaseCommand): # Collection of cat facts self.cat_facts = [ - "Cats have a third eyelid called a nictitating membrane that helps keep their eyes moist and protected. ๐Ÿฑ", + "Cats have a third eyelid called a nictitating membrane that protects and moistens their eyes. ๐Ÿฑ", "A group of cats is called a 'clowder' or a 'glaring'. ๐Ÿˆ", - "Cats can rotate their ears 180 degrees independently of each other. ๐Ÿ‘‚", - "The oldest known pet cat existed 9,500 years ago and was found buried with its human in Cyprus. ๐Ÿบ", - "Cats have over 30 muscles controlling their ears, while humans only have 6. ๐ŸŽง", - "A cat's purr vibrates at a frequency of 25-150 Hz, which can promote healing of bones and tissues. ๐Ÿฉน", - "Cats spend 70% of their lives sleeping - that's 13-16 hours per day! ๐Ÿ˜ด", + "Cats can rotate their ears 180 degrees independently to pinpoint sounds. ๐Ÿ‘‚", + "The oldest known pet cat existed 9,500 years ago in Cyprus. ๐Ÿบ", + "Cats have 32 muscles in each ear, while humans have only 6. ๐ŸŽง", + "A cat's purr vibrates at 25-150 Hz, which can promote healing of bones and tissues. ๐Ÿฉน", + "Cats sleep 12-18 hours per day - that's 50-70% of their lives! ๐Ÿ˜ด", "A cat's nose print is unique, just like human fingerprints. ๐Ÿ‘ƒ", - "Cats can't taste sweetness - they lack the taste receptors for sugar. ๐Ÿญ", - "The world's richest cat, Blackie, inherited ยฃ7 million from his owner in 1988. ๐Ÿ’ฐ", - "Cats have a very small, free-floating clavicle that allows them to always land on their feet. ๐Ÿฆด", - "A cat's heart beats 140-220 times per minute, about twice as fast as a human's heart. โค๏ธ", - "Cats have been known to survive falls from heights of over 20 stories due to their righting reflex. ๐Ÿข", - "The technical term for a cat's hairball is a 'bezoar'. ๐Ÿคฎ", - "Cats can jump up to 6 times their body length in a single bound. ๐Ÿฆ˜", - "A cat's whiskers are roughly as wide as their body, helping them judge if they can fit through spaces. ๐Ÿ“", - "Cats have 32 muscles in each ear, compared to humans' 6. ๐ŸŽฏ", - "The oldest cat ever recorded lived to be 38 years and 3 days old. ๐ŸŽ‚", + "Cats can't taste sweetness due to a missing taste receptor gene. ๐Ÿญ", + "Blackie the cat inherited ยฃ7 million ($12.5 million) in 1988. ๐Ÿ’ฐ", + "Cats have free-floating clavicles that give them extreme flexibility. ๐Ÿฆด", + "A cat's heart beats 140-220 times per minute, about twice as fast as a human's. โค๏ธ", + "Cats can survive falls from over 20 stories due to their righting reflex. ๐Ÿข", + "The technical term for a cat's hairball is a 'trichobezoar'. ๐Ÿคฎ", + "Cats can jump 5-6 times their body length in a single bound. ๐Ÿฆ˜", + "A cat's whiskers are as wide as their body, helping them judge if they can fit through spaces. ๐Ÿ“", + "Cats have 32 muscles in each ear to detect sounds and move ears independently. ๐ŸŽฏ", + "The oldest cat ever lived to 38 years and 3 days (Creme Puff, Texas). ๐ŸŽ‚", "Cats can run up to 30 mph in short bursts. ๐Ÿƒโ€โ™‚๏ธ", - "A cat's brain is 90% similar to a human's brain - they have the same regions for emotions. ๐Ÿง ", - "Cats have a special organ called the Jacobson's organ that allows them to 'taste' smells. ๐Ÿ‘…", - "The first cat in space was a French cat named Fรฉlicette, launched in 1963. ๐Ÿš€", - "Cats can see in near darkness - they only need 1/6th the light humans need to see. ๐ŸŒ™", + "Cat brains are 90% structurally similar to human brains. ๐Ÿง ", + "Cats have Jacobson's organ in the roof of their mouth that lets them 'taste' scents. ๐Ÿ‘…", + "Fรฉlicette was the first cat in space, launched by France in 1963. ๐Ÿš€", + "Cats need only 1/6th the light humans need to see clearly in the dark. ๐ŸŒ™", "A cat's tail contains nearly 10% of all the bones in its body. ๐Ÿฆด", - "Cats have been domesticated for over 4,000 years, longer than dogs. ๐Ÿ›๏ธ", - "The world's largest cat measured 48.5 inches long from nose to tail tip. ๐Ÿ“", - "Cats can make over 100 different sounds, while dogs can only make about 10. ๐ŸŽต", + "The world's longest cat measured 48.5 inches from nose to tail (Stewie, Maine Coon). ๐Ÿ“", + "Cats can make over 100 different vocalizations, while dogs make about 10. ๐ŸŽต", "A cat's sense of smell is 14 times stronger than a human's. ๐Ÿ‘ƒ", "Cats have a 'flehmen response' where they curl their lip to better detect scents. ๐Ÿ˜ฌ", - "The first cat show was held in London in 1871. ๐Ÿ†", - "Cats can drink seawater to survive - their kidneys can filter out the salt. ๐ŸŒŠ", - "A cat's purr can help lower blood pressure and reduce stress in humans. ๐Ÿง˜โ€โ™€๏ธ", - "Cats have been known to travel hundreds of miles to return to their homes. ๐Ÿ—บ๏ธ", + "The first major cat show was held in London in 1871 at Crystal Palace. ๐Ÿ†", + "Cats can drink seawater to survive - their kidneys filter out the salt efficiently. ๐ŸŒŠ", + "A cat's purr can help lower blood pressure and reduce stress in humans. ๐Ÿง˜", + "Cats can travel hundreds of miles home using their magnetic field sensitivity. ๐Ÿ—บ๏ธ", "The smallest cat breed is the Singapura, weighing only 4-8 pounds. โš–๏ธ", - "Cats can see ultraviolet light, which humans cannot see. ๐ŸŒˆ", - "A cat's tongue is covered in tiny, backward-facing hooks called papillae. ๐Ÿช", - "Cats have been worshipped as gods in ancient Egypt - they never forgot this. ๐Ÿ‘‘", - "The world's most expensive cat breed is the Ashera, costing up to $125,000. ๐Ÿ’Ž", - "Cats can rotate their ears 180 degrees and move them independently. ๐ŸŽง", - "A cat's heart beats 140-220 times per minute, twice as fast as a human's. ๐Ÿ’“" + "Cats can see ultraviolet light that humans cannot see. ๐ŸŒˆ", + "A cat's tongue is covered in 290-300 tiny backward-facing hooks called papillae. ๐Ÿช", + "Ancient Egyptians considered cats sacred vessels for the goddess Bastet. ๐Ÿ‘‘", + "Taylor Swift's cat Olivia Benson has a net worth of $97 million. ๐Ÿ’Ž", + "Cats have 230 bones in their body - 24 more than humans have. ๐Ÿฆด", + "Cats can hear frequencies up to 64,000 Hz, while humans max out at 20,000 Hz. ๐ŸŽง", + "Taylor Swift's cat Benjamin Button appeared on her TIME Person of the Year cover. ๐Ÿ“ฐ", + "Taylor Swift's cats are named Meredith Grey, Olivia Benson, and Benjamin Button. ๐ŸŽธ", + "Cats walk like camels and giraffes, moving both right legs then both left legs. ๐Ÿพ", + "The ancient Egyptian word for cat was 'Miu' or 'Mau' - sounding like a meow! ๐Ÿ“œ", + "Cat whiskers have nerve endings as sensitive as human fingertips. ๐ŸŽฏ", + "Only domestic cats walk with their tails held high as a sign of trust and happiness. ๐Ÿˆ", + "Cats have 250 million neurons in their cerebral cortex - more than dogs have. ๐Ÿง ", + "Cat purrs vibrate at the same frequency as bone-healing medical devices. ๐Ÿ’Š", + "Taylor Swift's cat Olivia has earned millions from appearing in music videos and ads. ๐Ÿ’ธ", + "Killing a cat in ancient Egypt was punishable by death. โš–๏ธ", + "Taylor Swift named her home recording studio 'The Itty Bitty Kitty Committee'. ๐ŸŽค", + "Taylor Swift's cat Olivia Benson is the official logo for Taylor Swift Productions. ๐Ÿ“บ", + "Ed Sheeran bought Scottish Fold cats after being inspired by Taylor Swift's cats. ๐ŸŽถ", + "Taylor Swift's cats have their own IMDB pages with acting credits. ๐ŸŽฌ", + "Mariska Hargitay named her cat 'Karma' after Taylor Swift's song. ๐Ÿ’•", + "Cats have dewclaws on their front paws that work like thumbs for gripping. ๐Ÿพ", + "Cat pupils can expand to 50% larger than human pupils to capture more light. ๐Ÿ‘๏ธ", + "Cats have 30 adult teeth compared to humans' 32. ๐Ÿฆท", + "Cats can taste ATP (energy molecules), which signals fresh meat to them. ๐Ÿ˜‹", + "Cats have whiskers on the backs of their front legs to detect prey movement. ๐Ÿฆต", + "The Egyptian Mau is the fastest domestic cat breed at 30 mph. ๐Ÿƒ", + "A Nobel Prize was awarded in 1981 for research using cat vision studies. ๐Ÿ…", + "Cats are digitigrade, meaning they walk on their toes, not flat-footed. ๐Ÿฆถ", + "Cats can filter salt from seawater - an adaptation from their desert-dwelling ancestors. ๐Ÿœ๏ธ", + "Cats were domesticated around 10,000-12,000 years ago in the Near East. ๐ŸŒ", + "Benjamin Button is the first and only cat to ever appear on TIME Person of the Year cover. ๐Ÿ“ธ", + "A cat's flexible spine allows them to rotate their body mid-air when falling. ๐Ÿคธ", + "Cats spend about 30-50% of their day grooming themselves and other cats. ๐Ÿ›", + "A cat's average body temperature is 101.5ยฐF (38.6ยฐC) - higher than humans. ๐ŸŒก๏ธ" ] def get_help_text(self) -> str: diff --git a/modules/commands/path_command.py b/modules/commands/path_command.py index 79f5a09..1ab8d54 100644 --- a/modules/commands/path_command.py +++ b/modules/commands/path_command.py @@ -49,6 +49,13 @@ class PathCommand(BaseCommand): self.medium_confidence_symbol = bot.config.get('Path_Command', 'medium_confidence_symbol', fallback='๐Ÿ“') self.low_confidence_symbol = bot.config.get('Path_Command', 'low_confidence_symbol', fallback='โ“') + # Check if "p" shortcut is enabled (off by default) + self.enable_p_shortcut = bot.config.getboolean('Path_Command', 'enable_p_shortcut', fallback=False) + if self.enable_p_shortcut: + # Add "p" to keywords if enabled + if "p" not in self.keywords: + self.keywords.append("p") + try: # Try to get location from Bot section if bot.config.has_section('Bot'): @@ -74,15 +81,23 @@ class PathCommand(BaseCommand): self.logger.warning(f"Error reading bot location from config: {e} - geographic proximity guessing disabled") def matches_keyword(self, message: MeshMessage) -> bool: - """Check if message starts with 'path' keyword""" + """Check if message starts with 'path' keyword or 'p' shortcut (if enabled)""" content = message.content.strip() # Handle exclamation prefix if content.startswith('!'): content = content[1:].strip() - # Check if message starts with any of our keywords content_lower = content.lower() + + # Handle "p" shortcut if enabled + if self.enable_p_shortcut: + if content_lower == "p": + return True # Just "p" by itself + elif (content.startswith('p ') or content.startswith('P ')) and len(content) > 2: + return True # "p " followed by path data + + # Check if message starts with any of our keywords for keyword in self.keywords: # Check for exact match or keyword followed by space if content_lower == keyword or content_lower.startswith(keyword + ' '):