Skip to content

Correct how command names derive from class names - #1507

Merged
akalongman merged 1 commit into
devfrom
docs-command-names
Nov 12, 2026
Merged

akalongman merged 1 commit into
devfrom
docs-command-names

Conversation

@akalongman

Copy link
Copy Markdown
Member

CLAUDE.md said a class FooBarCommand is reached as /foobar. A command file in a commands path is registered as /foo_bar (classNameToCommandName() inserts an underscore before each inner capital). /foobar resolves only through the fallback lookup, which builds a class name in a default Longman\TelegramBot\Commands\*Commands namespace and relies on PHP class names being case-insensitive, so it fails for a class in a custom namespace. The $name property sets the command name only for classes added through addCommandClass().

Checked at runtime: in a default namespace both foo_bar and foobar resolve to FooBarCommand; in a custom namespace baz_qux resolves to BazQuxCommand and bazqux resolves to nothing.

@akalongman
akalongman merged commit b67b274 into dev Nov 12, 2026
11 checks passed
@akalongman
akalongman deleted the docs-command-names branch November 12, 2026 14:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant