Refactor default command to accept raw text #24
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi,
during my attempts to use this library, I found that it was missing simple view that allowed me to just reply to a message with raw text. Creating a template can sometimes be an issue, or an overkill, depending on the situation. Especially when new to Django which is my case.
I have tried to refactor the TemplateCommandView the best I could, with a new BaseCommandView which could be the base for other types of actions (creating records for instance), and another base SendMessageCommandView which is the base for anything to send a message, which TemplateCommandView now extends.
Keeping full backwards compatibility has been in my mind. Which I think I achieved, except for the import of TemplateCommandView from
telegrambot.bot_views.generic.base
which now is inmessage
, but importing fromtelegrambot.bot_views.generic
still works.Let me know what you think.
(This is rebased on my branch
tests
which #23 is based on as well, so only this commit is new: 6d78ea1)