Skip to content

Commit

Permalink
Update Telegram Bot API usage
Browse files Browse the repository at this point in the history
  • Loading branch information
irshadahmad21 committed Feb 4, 2024
1 parent 9fd833f commit db8622a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
2 changes: 1 addition & 1 deletion plugins/wptelegram/src/modules/notify/NotifySender.php
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ private function prepare_default_responses() {
'sendMessage' => [
'text' => Utils::prepare_content( $text, $options ),
'parse_mode' => $options['format_to'],
'link_preview_options' => wp_json_encode( [ 'is_disabled' => true ] ),
'link_preview_options' => [ 'is_disabled' => true ],
],
],
];
Expand Down
14 changes: 6 additions & 8 deletions plugins/wptelegram/src/modules/p2tg/PostSender.php
Original file line number Diff line number Diff line change
Expand Up @@ -1105,7 +1105,7 @@ private function get_default_responses( $text, $image_source ) {

$parse_mode = MainUtils::valid_parse_mode( $this->options->get( 'parse_mode' ) );

$link_preview_options = wp_json_encode( $this->get_link_preview_options() );
$link_preview_options = $this->get_link_preview_options();
$disable_notification = $this->options->get( 'disable_notification' );
$protect_content = $this->options->get( 'protect_content' );

Expand Down Expand Up @@ -1284,7 +1284,7 @@ private function add_reply_markup( &$method_params ) {

if ( ! empty( $inline_keyboard ) ) {

$reply_markup = wp_json_encode( compact( 'inline_keyboard' ) );
$reply_markup = [ 'inline_keyboard' => $inline_keyboard ];

if ( isset( $method_params['sendMessage'] ) ) {

Expand Down Expand Up @@ -1469,12 +1469,10 @@ private function send_responses() {
$result = $res->get_result();
// send next message in reply to the previous one.
if ( ! empty( $result['message_id'] ) ) {
$params['reply_parameters'] = wp_json_encode(
[
'allow_sending_without_reply' => true,
'message_id' => $result['message_id'],
]
);
$params['reply_parameters'] = [
'allow_sending_without_reply' => true,
'message_id' => $result['message_id'],
];
}
}

Expand Down

0 comments on commit db8622a

Please sign in to comment.