Skip to content

Commit

Permalink
Merge pull request #333 from defstudio/fix-keyboards
Browse files Browse the repository at this point in the history
fix keyboards
  • Loading branch information
fabio-ivona authored Feb 6, 2023
2 parents e90de5e + 3b6f869 commit 402e954
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/Concerns/ManagesKeyboards.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,7 @@ public function keyboard(callable|array|Keyboard $keyboard): Telegraph
$keyboard = Keyboard::fromArray($keyboard);
}

$telegraph->data['reply_markup'] = [
'inline_keyboard' => $keyboard->toArray(),
];
data_set($telegraph->data, 'reply_markup.inline_keyboard', $keyboard->toArray());

return $telegraph;
}
Expand All @@ -55,9 +53,11 @@ public function replyKeyboard(callable|array|ReplyKeyboard $keyboard): Telegraph
$keyboard = ReplyKeyboard::fromArray($keyboard);
}

$telegraph->data['reply_markup'] = [
'keyboard' => $keyboard->toArray(),
] + $keyboard->options();
data_set($telegraph->data, 'reply_markup.keyboard', $keyboard->toArray());

foreach ($keyboard->options() as $option_key => $option_value) {
data_set($telegraph->data, "reply_markup.$option_key", $option_value);
}

return $telegraph;
}
Expand Down

0 comments on commit 402e954

Please sign in to comment.