-
Notifications
You must be signed in to change notification settings - Fork 223
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
Implement Bot API 7.0 #300
Conversation
@@ -5,7 +5,7 @@ module Bot | |||
module Types | |||
class KeyboardButton < Base | |||
attribute :text, Types::String | |||
attribute? :request_user, KeyboardButtonRequestUser | |||
attribute? :request_users, KeyboardButtonRequestUsers |
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.
Should we really replace (remove the old one)?
The old name will still work for backward compatibility.
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.
TBH, I don't know if we should. I plan to release it with 2.0 version, so breaking changes are possible. What do you think?
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.
I see nothing what would break this library. I think the deletion of the old name will be in a new API release. But… it's just for backward compatibility, and we have our own, so it's up to you.
I personally see request_user
with KeyboardButtonRequestUsers
type kind of confusing.
attribute :request_id, Types::Integer | ||
attribute? :user_is_bot, Types::Bool | ||
attribute? :user_is_premium, Types::Bool | ||
attribute? :max_quantity, Types::Integer |
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.
I'd add the default and probably even range validation:
1-10. Defaults to 1.
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.
Yep, added.
@@ -7,7 +7,7 @@ class KeyboardButtonRequestUsers < Base | |||
attribute :request_id, Types::Integer | |||
attribute? :user_is_bot, Types::Bool | |||
attribute? :user_is_premium, Types::Bool | |||
attribute? :max_quantity, Types::Integer.constrained(gteq: 1, lteq: 10).default(1) |
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.
Why a such "fix"? I'd leave the logic and change the specs.
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.
I'm too lazy to fix the specs for now. You're free to push changes if you want.
No description provided.