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

Case-insensitive command names #27

Open
rojvv opened this issue Sep 2, 2022 · 3 comments
Open

Case-insensitive command names #27

rojvv opened this issue Sep 2, 2022 · 3 comments
Projects

Comments

@rojvv
Copy link
Member

rojvv commented Sep 2, 2022

I think there should be an option to make command names case-insensitive, or do it by default.

Use Case

There are many use cases for this, and here's an example. Imagine we have a bot that configures PC builds, and includes a footer like this in one of its messages:

See /available_CPUs.

This cannot be handled if the command name passed to the filter doesn't look like the one in the message. And once it's handled the way it is displayed to the user, it can't be handled when the cases are changed, say all lower like /available_cpus.

It is case-insensitive by default in most of the other bot frameworks.

@KnorpelSenf
Copy link
Member

We should ask the community if this is desired by default. I don't think so, but it's best to hear the opinion of many people here.

I would like to keep the command handler in the core package free of configuration options. Custom behaviour for case sensitivity can be added in grammyjs/grammY#108.

@KnorpelSenf KnorpelSenf transferred this issue from grammyjs/grammY Jul 10, 2024
@KnorpelSenf
Copy link
Member

I think it makes a lot of sense for the commands plugin to support this in some way or another. That would also allow the core library to stay lean and not add too many options. There has been little demand for this, but in my personal view, the commands plugin is the right place for supporting every edge case. What do you think?

@roziscoding
Copy link
Contributor

Honestly, I thought we already supported this 😅
This makes total sense. I'll PQ in a few hours.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Triage
Coding
To do
Development

No branches or pull requests

3 participants