1
0
mirror of https://github.com/danog/MadelineProto.git synced 2024-11-30 09:38:57 +01:00

add editReplyMarkup

This commit is contained in:
AhJ 2023-12-31 23:04:07 +03:30
parent 10e43a7569
commit 0898d7cc68
2 changed files with 41 additions and 4 deletions

View File

@ -16,18 +16,19 @@
namespace danog\MadelineProto\EventHandler\Query;
use danog\MadelineProto\MTProto;
use danog\MadelineProto\ParseMode;
use danog\MadelineProto\MTProtoTools\DialogId;
use danog\MadelineProto\EventHandler\Update;
use danog\MadelineProto\EventHandler\Message;
use danog\MadelineProto\EventHandler\Message\ReportReason;
use danog\MadelineProto\EventHandler\Update;
use danog\MadelineProto\MTProto;
use danog\MadelineProto\MTProtoTools\DialogId;
use danog\MadelineProto\ParseMode;
/** @internal */
trait ChatTrait
{
/** @var int Chat where the inline keyboard was sent */
public readonly int $chatId;
/** @var int Message ID */
public readonly int $messageId;
@ -38,6 +39,7 @@ trait ChatTrait
$this->chatId = $API->getIdInternal($rawCallback['peer']);
$this->messageId = $rawCallback['msg_id'];
}
/**
* Edit message text.
*
@ -69,6 +71,24 @@ trait ChatTrait
return $this->getClient()->wrapMessage($this->getClient()->extractMessage($result));
}
/**
* Edit message keyboard.
*
* @param array $replyMarkup Reply markup for inline keyboards
*/
public function editReplyMarkup(array $replyMarkup): Message
{
$result = $this->getClient()->methodCallAsyncRead(
'messages.editMessage',
[
'peer' => $this->chatId,
'id' => $this->messageId,
'reply_markup' => $replyMarkup,
],
);
return $this->getClient()->wrapMessage($this->getClient()->extractMessage($result));
}
/**
* Delete the message.
*

View File

@ -46,6 +46,7 @@ trait InlineTrait
),
});
}
/**
* Edit message text.
*
@ -71,4 +72,20 @@ trait InlineTrait
],
);
}
/**
* Edit message keyboard.
*
* @param array $replyMarkup Reply markup for inline keyboards
*/
public function editReplyMarkup(array $replyMarkup)
{
$this->getClient()->methodCallAsyncRead(
'messages.editInlineBotMessage',
[
'id' => $this->rawId,
'reply_markup' => $replyMarkup,
],
);
}
}