Add button support to [p]now #6730

Merged
Evanroby merged 9 commits from now-button into V3/develop 2026-11-12 10:55:57 +01:00
Evanroby commented 2026-04-05 12:01:17 +02:00 (Migrated from github.com)

Description of the changes

Fixes #6133

Adds a button menu in utilities/menus directory, that is used on the [p]now command when [p]set usebuttons is true instead of the old reaction based menu

Have the changes in this PR been tested?

Yes

### Description of the changes Fixes #6133 Adds a button menu in `utilities/menus` directory, that is used on the `[p]now` command when `[p]set usebuttons` is true instead of the old reaction based menu ### Have the changes in this PR been tested? <!-- Choose one (remove the line that doesn't apply): --> Yes <!-- If the question doesn't apply (for example, it's not a code change), choose Yes. Please respond to this question truthfully. We do not delay nor reject PRs based on the answer to this question but it allows to better review this PR. -->
aikaterna (Migrated from github.com) reviewed 2026-04-05 12:01:17 +02:00
PredaaA (Migrated from github.com) reviewed 2026-04-05 12:01:17 +02:00
Jackenmen (Migrated from github.com) requested changes 2026-05-28 17:19:27 +02:00
Jackenmen (Migrated from github.com) left a comment

Aside from the review comments, I do feel it's a bit weird that we stop accepting actions after one action, but admittedly, this is consistent with the behaviour of how it works with reactions-based [p]now, so it makes more sense to address this in a separate PR.

Aside from the review comments, I do feel it's a bit weird that we stop accepting actions after one action, but admittedly, this is consistent with the behaviour of how it works with reactions-based `[p]now`, so it makes more sense to address this in a separate PR.
Jackenmen (Migrated from github.com) commented 2026-05-28 17:16:55 +02:00

This still needs to be checked for, just not if usebuttons is turned on.

This still needs to be checked for, just not if `usebuttons` is turned on.
Jackenmen (Migrated from github.com) commented 2026-05-28 15:45:38 +02:00
        if await ctx.bot.use_buttons():
```suggestion if await ctx.bot.use_buttons(): ```
Jackenmen (Migrated from github.com) commented 2026-05-28 15:51:46 +02:00

You can just check for everything in here and then simplify the later if checks to if not can_control:

        can_control = (
            not (dj_enabled or vote_enabled)
            or await self._can_instaskip(ctx, ctx.author)
            or await self.is_requester_alone(ctx)
        )
You can just check for everything in here and then simplify the later if checks to `if not can_control:` ```suggestion can_control = ( not (dj_enabled or vote_enabled) or await self._can_instaskip(ctx, ctx.author) or await self.is_requester_alone(ctx) ) ```
Evanroby commented 2026-05-28 21:24:29 +02:00 (Migrated from github.com)

Applied suggested changes

Applied suggested changes
Jackenmen (Migrated from github.com) requested changes 2026-11-09 00:15:06 +01:00
Jackenmen (Migrated from github.com) commented 2026-11-09 00:14:58 +01:00

This does not work.

  • commands.BotMissingPermissions in Red accepts a discord.Permissions object with missing permissions set to True, not a list of strings
  • read_message_history permission is needed to react to messages too
    I'd also prefer, if you instead used a custom commands.check for this (you can use bot_can_react()'s implementation as the starting point).

For reference, here's the traceback:

ERROR    [discord.client] Ignoring exception in on_message
Traceback (most recent call last):
  File "/home/ubuntu/work/Red-DiscordBot/.venv/lib/python3.10/site-packages/discord/ext/commands/bot.py", line 1376, in invoke
    await ctx.command.invoke(ctx)
  File "/home/ubuntu/work/Red-DiscordBot/.venv/lib/python3.10/site-packages/discord/ext/commands/core.py", line 1064, in invoke
    await injected(*ctx.args, **ctx.kwargs)  # type: ignore
  File "/home/ubuntu/work/Red-DiscordBot/.venv/lib/python3.10/site-packages/discord/ext/commands/core.py", line 266, in wrapped
    ret = await coro(*args, **kwargs)
  File "/home/ubuntu/work/Red-DiscordBot/redbot/cogs/audio/core/commands/controller.py", line 166, in command_now
    raise commands.BotMissingPermissions(["add_reactions"])
redbot.core.commands.errors.BotMissingPermissions

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/ubuntu/work/Red-DiscordBot/.venv/lib/python3.10/site-packages/discord/ext/commands/core.py", line 248, in wrapped
    ret = await coro(*args, **kwargs)
  File "/home/ubuntu/work/Red-DiscordBot/redbot/cogs/audio/core/events/dpy.py", line 429, in cog_command_error
    await self.bot.on_command_error(ctx, error, unhandled_by_cog=True)
  File "/home/ubuntu/work/Red-DiscordBot/redbot/core/_events.py", line 371, in on_command_error
    if bin(error.missing.value).count("1") == 1:  # Only one perm missing
AttributeError: 'list' object has no attribute 'value'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/ubuntu/work/Red-DiscordBot/.venv/lib/python3.10/site-packages/discord/client.py", line 508, in _run_event
    await coro(*args, **kwargs)
  File "/home/ubuntu/work/Red-DiscordBot/redbot/core/_events.py", line 446, in on_message
    await bot.process_commands(message)
  File "/home/ubuntu/work/Red-DiscordBot/redbot/core/bot.py", line 1747, in process_commands
    await self.invoke(ctx)
  File "/home/ubuntu/work/Red-DiscordBot/.venv/lib/python3.10/site-packages/discord/ext/commands/bot.py", line 1380, in invoke
    await ctx.command.dispatch_error(ctx, exc)
  File "/home/ubuntu/work/Red-DiscordBot/.venv/lib/python3.10/site-packages/discord/ext/commands/core.py", line 683, in dispatch_error
    await wrapped(ctx, error)
  File "/home/ubuntu/work/Red-DiscordBot/.venv/lib/python3.10/site-packages/discord/ext/commands/core.py", line 254, in wrapped
    raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'list' object has no attribute 'value'
This does not work. - `commands.BotMissingPermissions` in Red accepts a `discord.Permissions` object with missing permissions set to `True`, not a list of strings - `read_message_history` permission is needed to react to messages too I'd also prefer, if you instead used a custom `commands.check` for this (you can use `bot_can_react()`'s implementation as the starting point). For reference, here's the traceback: ``` ERROR [discord.client] Ignoring exception in on_message Traceback (most recent call last): File "/home/ubuntu/work/Red-DiscordBot/.venv/lib/python3.10/site-packages/discord/ext/commands/bot.py", line 1376, in invoke await ctx.command.invoke(ctx) File "/home/ubuntu/work/Red-DiscordBot/.venv/lib/python3.10/site-packages/discord/ext/commands/core.py", line 1064, in invoke await injected(*ctx.args, **ctx.kwargs) # type: ignore File "/home/ubuntu/work/Red-DiscordBot/.venv/lib/python3.10/site-packages/discord/ext/commands/core.py", line 266, in wrapped ret = await coro(*args, **kwargs) File "/home/ubuntu/work/Red-DiscordBot/redbot/cogs/audio/core/commands/controller.py", line 166, in command_now raise commands.BotMissingPermissions(["add_reactions"]) redbot.core.commands.errors.BotMissingPermissions During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/ubuntu/work/Red-DiscordBot/.venv/lib/python3.10/site-packages/discord/ext/commands/core.py", line 248, in wrapped ret = await coro(*args, **kwargs) File "/home/ubuntu/work/Red-DiscordBot/redbot/cogs/audio/core/events/dpy.py", line 429, in cog_command_error await self.bot.on_command_error(ctx, error, unhandled_by_cog=True) File "/home/ubuntu/work/Red-DiscordBot/redbot/core/_events.py", line 371, in on_command_error if bin(error.missing.value).count("1") == 1: # Only one perm missing AttributeError: 'list' object has no attribute 'value' The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/home/ubuntu/work/Red-DiscordBot/.venv/lib/python3.10/site-packages/discord/client.py", line 508, in _run_event await coro(*args, **kwargs) File "/home/ubuntu/work/Red-DiscordBot/redbot/core/_events.py", line 446, in on_message await bot.process_commands(message) File "/home/ubuntu/work/Red-DiscordBot/redbot/core/bot.py", line 1747, in process_commands await self.invoke(ctx) File "/home/ubuntu/work/Red-DiscordBot/.venv/lib/python3.10/site-packages/discord/ext/commands/bot.py", line 1380, in invoke await ctx.command.dispatch_error(ctx, exc) File "/home/ubuntu/work/Red-DiscordBot/.venv/lib/python3.10/site-packages/discord/ext/commands/core.py", line 683, in dispatch_error await wrapped(ctx, error) File "/home/ubuntu/work/Red-DiscordBot/.venv/lib/python3.10/site-packages/discord/ext/commands/core.py", line 254, in wrapped raise CommandInvokeError(exc) from exc discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'list' object has no attribute 'value' ```
Evanroby (Migrated from github.com) reviewed 2026-11-10 20:45:01 +01:00
Evanroby (Migrated from github.com) commented 2026-11-10 20:45:01 +01:00

Fixed

Fixed
Jackenmen (Migrated from github.com) reviewed 2026-11-12 10:53:55 +01:00
@ -19,11 +19,29 @@ from redbot.core.utils.predicates import ReactionPredicate
Jackenmen (Migrated from github.com) commented 2026-11-12 10:53:38 +01:00
        if missing:
```suggestion if missing: ```
Jackenmen (Migrated from github.com) approved these changes 2026-11-12 10:54:47 +01:00
Jackenmen (Migrated from github.com) left a comment

LGTM.

LGTM.
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!6730
No description provided.