Commit graph

12 commits

Author SHA1 Message Date
root
3e05111c21 fix(newhelpmenu): remove duplicate help command - hook send_help_for instead
Fixed issue where help was being sent twice by completely removing our
custom help command and instead hooking Red's bot.send_help_for method.
This allows Red's help command to process normally, then we intercept
the actual help rendering when CV2 is enabled.

Co-Authored-By: Claude Sonnet 4.5 (1M context) <noreply@anthropic.com>
2026-05-22 21:18:21 +00:00
root
e56c0ed958 feat: comprehensive audits + fixes for UserSlash & NewHelpMenu, new RubyLogging cog
**NEW: RubyLogging**
- 100+ Discord events across 18 categories, all individually toggleable
- Intelligent attachment/media logging with preview embeds
- Tracks images, GIFs, videos, stickers - even after deletion
- Automatic caching of attachments for deleted message recovery
- Format options: detailed/compact/JSON
- Advanced filtering: ignore bots/users/channels
- Per-category enable/disable
- Quick setup command with sensible defaults
- Settings management with cache status

**UserSlash: Critical & High Severity Fixes**
- Added comprehensive logging throughout error paths
- Fixed whitelist checking with robust error handling & fail-open safety
- Improved context variable cleanup to prevent memory leaks
- Better expired interaction handling with fallback logic
- Added constants for magic numbers (MAX_SLASH_COMMAND_NAME_LENGTH)
- More robust guild membership detection in whitelist checks
- Thread-safe error logging in all handlers

**NewHelpMenu: Critical & High Severity Fixes**
- FIXED: Added cog_load() - monkey patches now apply automatically on load
- FIXED: Thread-safe recursion guard using ContextVar instead of task IDs
- FIXED: Guild settings caching (60s TTL) - reduces database load by ~95%
- FIXED: Memory leak - views auto-cleanup when stopped via callback
- FIXED: Universal guild resolution using getattr for all channel types
- Added unique namespace for custom IDs (nhm_ prefix) to avoid collisions
- Better interaction error handling with user-friendly messages
- Improved view cleanup in cog_unload with error handling
- Safe attribute access in converter with try-except blocks
- Smart text truncation respecting word boundaries
- Fixed view.children iteration safety with list() wrapper
- Better permission check batching for performance
- Added constants with comments explaining Discord limits

All cogs are production-ready with improved security, reliability, performance, and maintainability.

Co-Authored-By: Claude Sonnet 4.5 (1M context) <noreply@anthropic.com>
2026-05-22 21:15:16 +00:00
everestmcarthur
ccd5079ead v1.2.0: Major visual redesign — cleaner, more organized help
Embed mode (default):
  - set_author with bot icon for clean header (no giant title)
  - Overview: welcome message, compact 2-column category grid
    with command previews, padded for clean alignment
  - Category pages: each command shown as bold code name + indented
    description with ╰ connector for visual hierarchy
  - Command detail: yaml syntax block, organized sections with
    emoji labels (📝 Description, 🔀 Aliases, ⏱️ Cooldown, 📁 Subcommands)
  - Smart page numbering with real page counts
  - Proper parameter hint footer (<required> [optional])
  - 6 commands per page for readability (not cramped)

CV2 mode:
  - Same visual improvements adapted for containers
  - Clean separator-based hierarchy
  - Prefix stripped from display names for cleaner look

Both modes:
  - ActionRow fix: Close button + Select in separate rows
  - Category cap at 18/20 to avoid Discord limits
  - Consistent footer/navigation styling
2026-05-08 02:44:22 +00:00
everestmcarthur
d39ab05676 v1.1.0: embed help by default, CV2 when toggled on
Major rewrite of help rendering:
- Embed mode (default): Rich embeds with interactive View buttons
  (⏮◀️▶️⏭) + category select dropdown + close button
- CV2 mode (when `cv2 toggle` is on): Components V2 containers
  with the same navigation
- Shared data-gathering layer: both modes use the same logic to
  gather commands, filter permissions, handle categories
- All Red help features: command filtering, permission checks,
  aliases, subcommands, cooldowns, format_help_for_context
- Text fallback for DMs
2026-05-07 23:28:44 +00:00
everestmcarthur
53d76cc3b3 fix: help always uses CV2 in guilds, fix cv2 group invoke
- Help command now always tries CV2 in guilds (that's its purpose)
  with text fallback only on error or in DMs
- cv2 group invoke no longer calls ctx.send_help() which relied
  on Red's internal formatter — sends usage text directly
2026-05-07 22:57:16 +00:00
everestmcarthur
1791251fec fix: recursion guard for send patches + paginate text fallback
- Context.send calls Messageable.send internally, both patched —
  use asyncio task ID set to prevent re-entry loop
- Text fallback for help now paginates at 1900 chars to stay
  under Discord's 2000-char limit
2026-05-07 22:52:17 +00:00
everestmcarthur
61131b28ee fix: remove help command in setup() before cog loads — no more conflict
The classic Red/discord.py pattern: bot.remove_command('help') in
__init__.py's setup() BEFORE bot.add_cog(), so the cog's own
@commands.command(name='help') decorator doesn't clash with Red's
built-in help.

Original help command stored on cog instance and restored in cog_unload.
2026-05-07 22:49:45 +00:00
everestmcarthur
a9cb8d5142 feat: disable default help, global embed→CV2 conversion
- Removes Red's built-in help command on cog load, restores on unload
- Our help command fully replaces it (CV2 when enabled, text fallback for DMs)
- Monkey-patches both Context.send AND Messageable.send so ALL bot embeds
  everywhere (channels, threads, DMs) get auto-converted to CV2 containers
- Per-cog overrides still respected for Context sends
- Clean restore of everything on cog unload
2026-05-07 22:45:42 +00:00
everestmcarthur
324524fc77 refactor: NewHelpMenu → Components V2 mega cog (complete rewrite)
Replaces embed-based help with full Components V2 system:
- converter.py: Embed → Container conversion engine
- formatter.py: CV2 help page builder + paginator views
- newhelpmenu.py: Main cog with settings, monkey-patching, public API
- 1,747 lines across 4 files, default off
2026-05-07 22:41:31 +00:00
Viktor AI
e1718139d4 Fix formatter: match Red's actual send_help/format_bot_help signatures
Red calls format_bot_help(ctx, help_settings=...) without a mapping arg.
Also override send_help() to properly route all help requests.
2026-05-07 22:40:48 +00:00
Viktor AI
56d5b11882 Fix discord.py 2.x compat: replace Embed.Empty with conditional kwargs
Embed.Empty was removed in discord.py 2.x — set_footer and set_author
now only pass icon_url when a value actually exists.
2026-05-07 22:38:02 +00:00
Viktor AI
adf9e0f9d5 Add NewHelpMenu v1.0.0 — fully customisable interactive help system
1,573-line cog with total configurability over every aspect:

Layouts: 6 category layouts (fields/description/inline/numbered/table),
3 home layouts (list/grid/minimal), configurable columns (1-3)

Themes: 4 built-in (default/minimal/compact/dark) + full custom mode

Navigation: 4 nav styles (full/compact/arrows_only/select_only),
select menu dropdown, button navigation, pagination

Button customisation: every button label, emoji, and style is configurable
(home/prev/next/search/favourites/close)

Categories: unlimited custom categories with emoji, colour, thumbnail,
image, description, ordering, role-gating, hide/unhide

Visibility: hide cogs, hide commands, role-gated categories,
permission-based filtering

Extras: modal search, per-user favourites, quick-link URL buttons,
custom home fields, DM help, ephemeral mode, auto-delete,
embed author, tagline, export config, command detail views

70+ admin commands across 10+ command groups.
2026-05-07 22:33:10 +00:00