Using ctx.send_help() in a hybrid command's slash command causes a timeout if the help menu is set to pagified #5916

Closed
opened 2022-11-27 03:25:32 +01:00 by karlsbjorn · 2 comments
karlsbjorn commented 2022-11-27 03:25:32 +01:00 (Migrated from github.com)

What Red version are you using?

3.5.0.dev, commit bbb15924b9

What were you trying to do?

Use ctx.send_help() to send a message as a response to a slash command while [p]helpset usemenus is set to disable.

What did you expect to happen?

Send the help message without any errors, like a ctx.send() or [p]help test.

What actually happened?

The bot sent the help menu as its own message, but it also didn't respond to the interaction, causing it to time out.
Using ctx.send_help() with any other [p]helpset usemenus option works as intended.

eui9gtmx7F

How can we reproduce this error?

  1. [p]helpset usemenus disable
  2. Add ctx.send_help() to a command
  3. Trigger it
from redbot.core.commands import commands


class Test(commands.Cog):
    def __init__(self, bot):
        self.bot = bot

    @commands.hybrid_command()
    async def test(self, ctx):
        await ctx.send_help()

The above code sample needs to be invoked as a slash command.

Anything else?

Adding a ctx.defer() before ctx.send_help() does not fix this, it only extends the time it takes for the time out to happen.

### What Red version are you using? 3.5.0.dev, commit bbb15924b969eb6fa170b3603556b5bcb9830a0f ### What were you trying to do? Use `ctx.send_help()` to send a message as a response to a slash command while `[p]helpset usemenus` is set to `disable`. ### What did you expect to happen? Send the help message without any errors, like a `ctx.send()` or `[p]help test`. ### What actually happened? The bot sent the help menu as its own message, but it also didn't respond to the interaction, causing it to time out. Using `ctx.send_help()` with any other `[p]helpset usemenus` option works as intended. ![eui9gtmx7F](https://user-images.githubusercontent.com/40699625/204116268-089cab2d-6a2e-4a08-a595-7ed54b035c60.png) ### How can we reproduce this error? 1. `[p]helpset usemenus disable` 2. Add `ctx.send_help()` to a command 3. Trigger it ```py from redbot.core.commands import commands class Test(commands.Cog): def __init__(self, bot): self.bot = bot @commands.hybrid_command() async def test(self, ctx): await ctx.send_help() ``` The above code sample needs to be invoked as a slash command. ### Anything else? Adding a `ctx.defer()` before `ctx.send_help()` does not fix this, it only extends the time it takes for the time out to happen.
Flame442 commented 2022-11-27 03:33:34 +01:00 (Migrated from github.com)

github.com/Cog-Creators/Red-DiscordBot@bbb15924b9/redbot/core/commands/help.py (L860-L862)

This seems to be the line causing this. Other settings for usemenus uses some variation of ctx.send, however this particular case accounts for the potential for len(pages) > max_pages situations by using channel.send instead, which does NOT cause a hybrid command interaction to be responded to. I suspect we are going to run into lots of this kind of issue as we transition into slash, it's just a question of whether we want to make core be more friendly to hybrid commands.

https://github.com/Cog-Creators/Red-DiscordBot/blob/bbb15924b969eb6fa170b3603556b5bcb9830a0f/redbot/core/commands/help.py#L860-L862 This seems to be the line causing this. Other settings for `usemenus` uses some variation of `ctx.send`, however this particular case accounts for the potential for `len(pages) > max_pages` situations by using *`channel.send`* instead, which does NOT cause a hybrid command interaction to be responded to. I suspect we are going to run into lots of this kind of issue as we transition into slash, it's just a question of whether we want to make core be more friendly to hybrid commands.
Evanroby commented 2026-04-01 16:04:28 +02:00 (Migrated from github.com)

Was this fixed? it appears to have been fixed for me (I followed all the steps correctly tho)
just me being dumb, sorry!
Image

Image
~~Was this fixed? it appears to have been fixed for me (I followed all the steps correctly tho)~~ just me being dumb, sorry! <img width="320" height="127" alt="Image" src="https://github.com/user-attachments/assets/724146c0-c39d-4413-b7bc-8183585d6bba" /> <img width="620" height="314" alt="Image" src="https://github.com/user-attachments/assets/2dcdfffe-8a69-4d24-b50f-07afcce1cf75" />
Sign in to join this conversation.
No labels
Automated PR
Blocked
Blocked By: Damage Control
Blocked By: Dependency
Blocked By: Other PR
Breaking Change
Category: CI
Category: Cogs - Admin
Category: Cogs - Alias
Category: Cogs - Audio
Category: Cogs - Bank
Category: Cogs - Cleanup
Category: Cogs - CustomCommands
Category: Cogs - Dev
Category: Cogs - Downloader
Category: Cogs - Economy
Category: Cogs - Filter
Category: Cogs - General
Category: Cogs - Image
Category: Cogs - Mod
Category: Cogs - Modlog
Category: Cogs - Mutes
Category: Cogs - Permissions
Category: Cogs - Reports
Category: Cogs - Streams
Category: Cogs - Trivia
Category: Cogs - Trivia - Lists
Category: Cogs - Warnings
Category: Core - API - App Commands Package
Category: Core - API - Audio
Category: Core - API - Bank
Category: Core - API - Commands Package
Category: Core - API - Config
Category: Core - API - Other
Category: Core - API - Utils Package
Category: Core - Bot Class
Category: Core - Bot Commands
Category: Core - Command-line Interfaces
Category: Core - Downloader
Category: Core - Help
Category: Core - i18n
Category: Core - Modlog
Category: Core - Other Internals
Category: Core - RPC/ZMQ
Category: Docker
Category: Docs - Changelogs
Category: Docs - For Developers
Category: Docs - Install Guides
Category: Docs - Other
Category: Docs - User Guides
Category: Meta
Category: RPC/ZMQ methods
Category: Vendored Packages
Changelog Entry: Added
Changelog Entry: Pending
Changelog Entry: Skipped
Closed: Duplicate
Closed: External
Closed: Invalid
Closed: User Error
Closed: Won't Fix
Complex Issue
Docs-only
Feature Branch
Good First Issue
Help Wanted
High Priority
Needs Backport To stable-docs
No Activity
No Repro
QA: Bypassed
QA: Changes Requested
QA: Passed
Release Blocker
Status: Accepted
Status: Frozen
Status: In Progress
Status: Needs Discussion
Status: Needs Info
Status: Needs Triage
Status: PRs Welcome
Type: Bug
Type: Dependency Update
Type: Deprecation
Type: Enhancement
Type: Feature
Type: Informational
Type: Merge
Type: Optimisation
Type: Question
Type: Removal
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
Mrcoolgamer11/Red-DiscordBot#5916
No description provided.