quote plugin added. Fixed funguy.py and plugins.py for plugin list.

This commit is contained in:
2026-05-07 22:43:21 -05:00
parent c263b2c40e
commit a4f3725354
4 changed files with 236 additions and 72 deletions
Executable → Regular
-40
View File
@@ -213,46 +213,6 @@ class FunguyBot:
await self.bot.api.send_text_message(room.room_id, "You are not authorized to enable plugins.") # Sending unauthorized message
return
# List plugins command with descriptions (bold plugin names)
if match.is_not_from_this_bot() and match.prefix() and match.command("plugins"):
if self.PLUGINS:
# Build a list with plugin names and their descriptions
plugin_list = []
for plugin_name in sorted(self.PLUGINS.keys()):
plugin_module = self.PLUGINS[plugin_name]
# Try to get description from plugin
description = getattr(plugin_module, "__description__", None)
if not description:
# Try to get from docstring
docstring = getattr(plugin_module, "__doc__", None)
if docstring:
# Get first line of docstring
description = docstring.strip().split('\n')[0]
else:
description = "No description available"
# Make plugin name bold using HTML <strong> tag
plugin_list.append(f"<strong>[{plugin_name}.py]</strong>: {description}")
# Send as HTML message (bold will render)
response = "\n".join(plugin_list)
# Split into multiple messages if too long
if len(response) > 4000:
chunk = ""
for line in plugin_list:
if len(chunk) + len(line) + 1 > 4000:
await self.bot.api.send_markdown_message(room.room_id, chunk)
chunk = line + "\n"
else:
chunk += line + "\n"
if chunk:
await self.bot.api.send_markdown_message(room.room_id, chunk)
else:
await self.bot.api.send_markdown_message(room.room_id, response)
else:
await self.bot.api.send_text_message(room.room_id, "No plugins are currently loaded.")
return
# Rehash config command
if match.is_not_from_this_bot() and match.prefix() and match.command("rehash"):
if str(message.sender) == self.config.admin_user: # Checking if sender is admin user