-
Notifications
You must be signed in to change notification settings - Fork 294
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
Telegram Bot API library and sample of a Telegram chat bot #385
base: develop
Are you sure you want to change the base?
Conversation
CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅ |
I hereby agree to the terms of the CLA available at: https://yandex.ru/legal/cla/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Greet job, but have few comments.
@@ -185,6 +185,10 @@ if (USERVER_FEATURE_MYSQL) | |||
add_subdirectory(mysql "${CMAKE_BINARY_DIR}/userver/mysql") | |||
endif() | |||
|
|||
if (USERVER_FEATURE_CORE) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like this feature should be named as USERVER_FEATURE_TELEGRAM
.
@@ -0,0 +1,12 @@ | |||
-------------------------------------------------------------------------------- |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better to describe api in openapi schema format. This is almost a standard to communicate between services and many code generator tools is supported it.
Have you seen json schema? https://core.telegram.org/schema/json
More details available here: https://core.telegram.org/schema
Anyway, looks like all of request-response could be generated in-fly in build directory.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wrong place, should be in ../client/ folder
|
||
virtual LogOutRequest LogOut(const RequestOptions& request_options) = 0; | ||
|
||
virtual SendAnimationRequest SendAnimation( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like the most of this method does not required at all.
They do the same as public FormRequest<T>(T::Parameters{...}, request_options);
|
||
private: | ||
template <typename Request> | ||
Request FormRequest( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FormRequest -> CreateRequest
and make it public. You'll got the same result, but less code.
const components::ComponentConfig& config, | ||
const components::ComponentContext& context); | ||
|
||
telegram::bot::RequestOptions request_options_; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This field could be moved inside of components clients and provided within client.hpp.
It looks statically configurable and may be provided by ComponentConfig or dynamic_config
}; | ||
|
||
template <typename method> | ||
class [[nodiscard]] Request { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like a real client class client/client.hpp
, as it is actually should be.
Anyway, telegram/bot/client
is a better place for it.
Resolves #227