""" Plugin for providing a command to display the list of available commands and their descriptions. """ import logging import simplematrixbotlib as botlib async def handle_command(room, message, bot, prefix, config): """ Function to handle the !help command. Args: room (Room): The Matrix room where the command was invoked. message (RoomMessage): The message object containing the command. bot (MatrixBot): The Matrix bot instance. prefix (str): The command prefix. config (dict): The bot's configuration. Returns: None """ match = botlib.MessageMatch(room, message, bot, prefix) if match.is_not_from_this_bot() and match.prefix() and match.command("help"): logging.info("Fetching command help documentation") commands_message = """
🍄 Funguy Bot Commands 🍄

📖 !help

Displays comprehensive help documentation for all available commands with usage examples.

🔌 !plugins

Lists all loaded plugins along with their descriptions in alphabetical order.

🃏 !fortune

Returns a random fortune message. Executes the `/usr/games/fortune` utility and sends the output as a message to the chat room.

!date

Displays the current date and time. Fetches the current date and time using Python's `datetime` module and sends it in a formatted message with proper ordinal suffixes to the chat room.

💻 !proxy

Retrieves a tested/working random SOCKS5 proxy. Fetches a list of SOCKS5 proxies from public sources, tests their availability, and sends the first working proxy with latency information to the chat room. Caches working proxies for faster access.

📶 !isup [domain/ip]

Checks if the specified domain or IP address is reachable. Performs DNS resolution and checks HTTP/HTTPS service availability. Reports successful DNS resolution and service status.

!karma [user]

Retrieves the karma points for the specified user. Retrieves the karma points for the specified user from a SQLite database and sends them as a message to the chat room.

!karma [user] up

Increases the karma points for the specified user by 1. Increases the karma points for the specified user by 1 in the database and sends the updated points as a message to the chat room. Users cannot modify their own karma.

!karma [user] down

Decreases the karma points for the specified user by 1. Decreases the karma points for the specified user by 1 in the database and sends the updated points as a message to the chat room. Users cannot modify their own karma.

🌧️ !weather [location]

Fetches current weather information for any location using OpenWeatherMap API. Shows temperature (Celsius/Fahrenheit), conditions, humidity, wind speed, and weather emojis. Requires OPENWEATHER_API_KEY environment variable.

📖 !ud [term] [index]

Fetches definitions from Urban Dictionary. Use without arguments for random definition, or specify term and optional index number. Shows definition, example, author, votes, and permalink.

🔍 !dns [domain]

Performs comprehensive DNS reconnaissance on a domain. Queries multiple DNS record types including A, AAAA, MX, NS, TXT, CNAME, SOA, and SRV records. Validates domain format and provides formatted results.

💰 !btc

Fetches the current Bitcoin price in USD from bitcointicker.co API. Shows real-time BTC/USD price with proper formatting. Includes error handling for API timeouts and data parsing issues.

🔍 !shodan [command] [query]

Shodan.io integration for security reconnaissance and threat intelligence.

Commands:

Search Examples:

Common Filters: country, city, port, product, os, org, net, has_ssl, http.title

Requires SHODAN_KEY environment variable

📸 !sd [prompt]

Generates images using self-hosted Stable Diffusion. Supports options: --steps, --cfg, --h, --w, --neg, --sampler. Uses queuing system to handle multiple requests. See available options using just '!sd'.

📄 !text [prompt]

Generates text using Ollama's Mistral 7B Instruct model. Options: --max_tokens, --temperature. Uses queuing system for sequential processing.

📰 !xkcd

Fetches and displays a random XKCD comic. Downloads comic image and sends it directly to the chat room.

🎬 YouTube Features

Automatic preview when YouTube links are posted. Shows video info, description, and attempts to fetch lyrics. Also supports !yt [search terms] for direct YouTube searching.

⏱️ !cron [add|remove] [room_id] [cron_entry] [command]

Schedule automated commands using cron syntax. Add or remove cron jobs for specific rooms and commands.

🔧 Admin Commands

!set [option] [value] - Set configuration options (admin_user, prefix)
!get [option] - Get configuration values
!saveconf - Save current configuration
!loadconf - Load saved configuration
!show - Display current configuration
!reset - Reset configuration to defaults
!load [plugin] - Load a plugin
!unload [plugin] - Unload a plugin
!reload - Reload all plugins
!disable [plugin] [room_id] - Disable a plugin for specific room
!enable [plugin] [room_id] - Enable a plugin for specific room
!rehash - Reload configuration
Note: Admin commands require admin_user privileges

🤖 Funguy Bot AI Commands

Creative & Writing: !write, !script, !author, !poem, !rap, !story, !comic, !motiv, !debate, !crit, !litcrit
Technical: !tech, !dev, !py, !php, !regex, !math, !web, !it, !security, !ai, !ml, !data, !game, !gaming
Professional: !seo, !recruit, !coach, !devrel, !sales, !ceo, !mgmt, !startup, !invest, !fin, !acad
Educational: !tutor, !teach, !edu, !hist, !astro, !chem, !psych, !meditate, !socrat, !philos
Lifestyle: !fit, !health, !diet, !cook, !travel, !art, !music, !film, !selfhelp
Specialized: !legal, !medical, !realest, !auto, !fashion, !design, !interior, !florist
Communication: !pron, !spk, !speak, !eloc, !comm, !msg, !langdet
Business: !eth, !browse, !search, !create, !review, !curation, !domain
Entertainment: !char, !adv, !advgame, !esc, !title, !stats, !prompt
Technical Specialties: !intv, !plag, !trv, !foot, !rel, !etymo, !magic, !counsel, !behavior, !mh, !log, !dental, !acc, !chef, !tea, !telemed, !law, !trans, !chess, !time, !dream, !r, !emergency, !worksheet, !test, !create, !guide, !diag, !therapy, !gen, !drunk, !rec, !techtrans, !proof, !spirit, !friend, !chat, !wiki, !kanji, !note, !enhance, !nav, !hypno, !critic, !comp, !journo, !pscoach, !makeup, !childcare, !writing, !syn, !shop, !dining
Each AI command uses specialized prompts optimized for different domains and interfaces with local AI models. Consult ai.json

🌟 Funguy Bot Credits

🧙‍♂️ Creator & Developer: HB is the author of 🍄Funguy Bot🍄. (@hashborgir:mozilla.org)
🚀 Development Context: Created during recovery from two-level cervical spinal surgery (CDA Cervical Discectomy and Disc Arthroplasty)

Join our Matrix Room: Self-hosting | Security | Sysadmin | Homelab | Programming

""" await bot.api.send_markdown_message(room.room_id, commands_message) logging.info("Sent help documentation to the room")