-
Notifications
You must be signed in to change notification settings - Fork 0
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
Optional ReplyKeyboardMarkup creation depending on specific #8
base: dev
Are you sure you want to change the base?
Conversation
…eplyKeyboardMarkup instead of InlineKeyboardMarkup for Telegram bridge
nil if keyboard_object.nil? || !keyboard_object.to_a.count.positive? | ||
|
||
inline_keyboard = [] | ||
if output.specifics.has?(:tg_reply_keyboard) == false || output.specifics.get(:tg_reply_keyboard) == false |
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.
Check for :tg_reply_keyboard == true
in this case - use reply keyboard
Otherwise, use inline keyboard by default
And only one check for get == nil is sufficient
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.
@@ -66,34 +66,34 @@ def setup | |||
output_convert :keyboard, :tg_reply_markup do |keyboard_object, input, output| | |||
nil if keyboard_object.nil? || !keyboard_object.to_a.count.positive? | |||
|
|||
if output.specifics.has?(:tg_reply_keyboard) == false || output.specifics.get(:tg_reply_keyboard) == false | |||
inline_keyboard = [] | |||
if output.specifics.get :tg_reply_keyboard |
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 check explicitly for true because any object or something passed here will be considered truthy. Only falsy values are false, nil.
Just in case. I doubt there will be the case
but just to be sure we won't have any side effects
else | ||
regular_keyboard = [] | ||
inline_keyboard = [] |
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 whole if/else code can be refactored to reduce copypaste
No description provided.