Commit 5000d1e
committed
feat(bot): implement command registration system with
- Introduce `GenerateCommand` class:
- Provides a unified mechanism to register bot commands dynamically.
- Leverages `grammy` bot framework for command registration.
- Add `registerCommand` method:
- Dynamically binds and registers command handlers from `GeneralCommands` and `UserCommands`.
- Safely checks for the existence of a command handler before registration.
- Uses the `bind` method to ensure the proper context (`this`) for command handlers.
- Add `generate` method:
- Iterates over all command names defined in the `COMMANDS` array.
- Registers each command by delegating to the `registerCommand` method.GenerateCommand class1 parent 34913bd commit 5000d1e
1 file changed
Lines changed: 28 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
0 commit comments