[CustomCom] Error on not capitalizing member #5026

Closed
opened 2021-05-04 16:46:54 +02:00 by SharkyTheKing · 0 comments
SharkyTheKing commented 2021-05-04 16:46:54 +02:00 (Migrated from github.com)

What Red version are you using?

3.4.9

Cog name

Customcom

Command name

customcom create simple

What did you expect to happen?

One of my bot users used the command, which I replicated due to their content not being appropriate.
Usage: [p]cc create simple test {0.mention:member} testing 1 2 3

I would expect it to give back a message saying something along the lines that {0.mention:member} is not valid as you need to capitalize M in member, instead of just completely erroring out. This doesn't give any details to the user using it on what they'd need to fix in their custom command.

The correct way to use this command is:
[p]cc create simple test {0.mention:Member} testing 1 2 3

LP9W8pGfqA

What actually happened?

It errored out, saying to check console or logs rather than giving a message to explain.
Z9YrREMfr1

How can we reproduce this error?

  1. Create a customcommand using {0.mention:member} as the output response.
  2. Watch the response it gives, whether it'll fail or succeed.
  3. Try again but capitalizing M in member to see confirm success. {0.mention:Member}

Anything else?

Here is the traceback for the member not being capitalize at first.

Traceback (most recent call last):
  File "/home/sharky/.local/lib/python3.8/site-packages/redbot/cogs/customcom/customcom.py", line 708, in prepare_args
    getattr(commands, anno.__name__ + "Converter")
AttributeError: module 'redbot.core.commands' has no attribute 'discord.memberConverter'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/sharky/.local/lib/python3.8/site-packages/discord/ext/commands/core.py", line 85, in wrapped
    ret = await coro(*args, **kwargs)
  File "/home/sharky/.local/lib/python3.8/site-packages/redbot/cogs/customcom/customcom.py", line 394, in cc_create_simple
    await self.commandobj.create(ctx=ctx, command=command, response=text)
  File "/home/sharky/.local/lib/python3.8/site-packages/redbot/cogs/customcom/customcom.py", line 135, in create
    ctx.cog.prepare_args(response if isinstance(response, str) else response[0])
  File "/home/sharky/.local/lib/python3.8/site-packages/redbot/cogs/customcom/customcom.py", line 710, in prepare_args
    anno = allowed_builtins.get(anno.lower(), Parameter.empty)
AttributeError: module 'discord.member' has no attribute 'lower'

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

Traceback (most recent call last):
  File "/home/sharky/.local/lib/python3.8/site-packages/discord/ext/commands/bot.py", line 939, in invoke
    await ctx.command.invoke(ctx)
  File "/home/sharky/.local/lib/python3.8/site-packages/redbot/core/commands/commands.py", line 832, in invoke
    await super().invoke(ctx)
  File "/home/sharky/.local/lib/python3.8/site-packages/discord/ext/commands/core.py", line 1348, in invoke
    await ctx.invoked_subcommand.invoke(ctx)
  File "/home/sharky/.local/lib/python3.8/site-packages/redbot/core/commands/commands.py", line 832, in invoke
    await super().invoke(ctx)
  File "/home/sharky/.local/lib/python3.8/site-packages/discord/ext/commands/core.py", line 1348, in invoke
    await ctx.invoked_subcommand.invoke(ctx)
  File "/home/sharky/.local/lib/python3.8/site-packages/discord/ext/commands/core.py", line 863, in invoke
    await injected(*ctx.args, **ctx.kwargs)
  File "/home/sharky/.local/lib/python3.8/site-packages/discord/ext/commands/core.py", line 94, in wrapped
    raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: module 'discord.member' has no attribute 'lower'
### What Red version are you using? 3.4.9 ### Cog name Customcom ### Command name customcom create simple ### What did you expect to happen? One of my bot users used the command, which I replicated due to their content not being appropriate. Usage: `[p]cc create simple test {0.mention:member} testing 1 2 3` I would expect it to give back a message saying something along the lines that `{0.mention:member}` is not valid as you need to capitalize `M` in `member`, instead of just completely erroring out. This doesn't give any details to the user using it on what they'd need to fix in their custom command. The correct way to use this command is: `[p]cc create simple test {0.mention:Member} testing 1 2 3` <img width="369" alt="LP9W8pGfqA" src="https://user-images.githubusercontent.com/42697462/117021027-3482a500-acb4-11eb-92da-d1f8182f4d73.png"> ### What actually happened? It errored out, saying to check console or logs rather than giving a message to explain. <img width="490" alt="Z9YrREMfr1" src="https://user-images.githubusercontent.com/42697462/117020985-2b91d380-acb4-11eb-8037-9f06564b98c7.png"> ### How can we reproduce this error? 1. Create a customcommand using `{0.mention:member}` as the output response. 2. Watch the response it gives, whether it'll fail or succeed. 3. Try again but capitalizing M in `member` to see confirm success. `{0.mention:Member}` ### Anything else? Here is the traceback for the `member` not being capitalize at first. ```py Traceback (most recent call last): File "/home/sharky/.local/lib/python3.8/site-packages/redbot/cogs/customcom/customcom.py", line 708, in prepare_args getattr(commands, anno.__name__ + "Converter") AttributeError: module 'redbot.core.commands' has no attribute 'discord.memberConverter' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/sharky/.local/lib/python3.8/site-packages/discord/ext/commands/core.py", line 85, in wrapped ret = await coro(*args, **kwargs) File "/home/sharky/.local/lib/python3.8/site-packages/redbot/cogs/customcom/customcom.py", line 394, in cc_create_simple await self.commandobj.create(ctx=ctx, command=command, response=text) File "/home/sharky/.local/lib/python3.8/site-packages/redbot/cogs/customcom/customcom.py", line 135, in create ctx.cog.prepare_args(response if isinstance(response, str) else response[0]) File "/home/sharky/.local/lib/python3.8/site-packages/redbot/cogs/customcom/customcom.py", line 710, in prepare_args anno = allowed_builtins.get(anno.lower(), Parameter.empty) AttributeError: module 'discord.member' has no attribute 'lower' The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/home/sharky/.local/lib/python3.8/site-packages/discord/ext/commands/bot.py", line 939, in invoke await ctx.command.invoke(ctx) File "/home/sharky/.local/lib/python3.8/site-packages/redbot/core/commands/commands.py", line 832, in invoke await super().invoke(ctx) File "/home/sharky/.local/lib/python3.8/site-packages/discord/ext/commands/core.py", line 1348, in invoke await ctx.invoked_subcommand.invoke(ctx) File "/home/sharky/.local/lib/python3.8/site-packages/redbot/core/commands/commands.py", line 832, in invoke await super().invoke(ctx) File "/home/sharky/.local/lib/python3.8/site-packages/discord/ext/commands/core.py", line 1348, in invoke await ctx.invoked_subcommand.invoke(ctx) File "/home/sharky/.local/lib/python3.8/site-packages/discord/ext/commands/core.py", line 863, in invoke await injected(*ctx.args, **ctx.kwargs) File "/home/sharky/.local/lib/python3.8/site-packages/discord/ext/commands/core.py", line 94, in wrapped raise CommandInvokeError(exc) from exc discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: module 'discord.member' has no attribute 'lower' ```
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#5026
No description provided.