Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Argument converters fail to read arguments with capital letters in the name #169

Open
Cypher121 opened this issue Aug 3, 2022 · 2 comments
Assignees
Labels
Type: Enhancement Improvements to existing features.

Comments

@Cypher121
Copy link

Description

Argument converters like stringChoice allow using a capitalized argument name for the name attribute. However when using a command with such an argument, the value is not read correctly, either using the default, if one exists, or showing an error (Invalid value for argument Choice (which accepts: text))

Versions

Latest KordEx snapshot at 1.5.5-SNAPSHOT

Code Examples

class TestExtension : Extension() {
    override val name = "test"

    override suspend fun setup() {
        publicSlashCommand(::TestArgs) {
            name = "test"
            description = "test"

            guild(TEST_SERVER_ID)

            action {
                respond {
                    content = arguments.choice
                }
            }
        }
    }

    class TestArgs : Arguments() {
        val choice by stringChoice {
            name = "Choice"
            description = "Choice"

            choices = listOf("this", "other", "that")
                .associateBy { it }
                .toMutableMap()
        }
    }
}

Suggestions

I'd suggest disallowing capitals in the name entirely: discord lowercases arg names anyway, so it's misleading to allow them. Same goes for command names as well.

@Cypher121 Cypher121 added the Type: Bug Something isn't working correctly. label Aug 3, 2022
@boring-cyborg
Copy link

boring-cyborg bot commented Aug 3, 2022

Hello, and thanks for opening an issue! As this is the first time you've created an issue on this repository, we'd just like to offer you a warm welcome to the project, and the following pointers:

  • Most importantly, all issues must adhere to our Code of Conduct. Please give it a quick read if you haven't already.

  • While our team is passionate about the projects we've created here, we're all volunteers. Please don't be offended if it takes time for us to get to your issue - we'll be here as soonas we can be!

  • Please provide as much information as possible when asking a question, reporting a problem, or submitting a feature request. This will help us to address your issue quickly and efficiently. If you forgot to add some information, no worries - feel free to edit the issue and add anything you missed!

    Thanks for contacting us! If you have any further questions, please feel free to join us on Discord in the #dev-kotdis channel (or #kordex-discussion for Kord Extensions projects), or to contact a staff member directly.

@gdude2002
Copy link
Member

Discord is fairly inconsistent with its support for capitalization, and I don't think a simple case check is sufficient because of i18n. It's true that this should be better telegraphed somehow, but I'm not 100% sure what the best way to do that is.

@gdude2002 gdude2002 self-assigned this Aug 4, 2022
@gdude2002 gdude2002 added Type: Enhancement Improvements to existing features. and removed Type: Bug Something isn't working correctly. labels Aug 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Enhancement Improvements to existing features.
Projects
None yet
Development

No branches or pull requests

2 participants