Add AnswerShippingQuery method
This commit is contained in:
parent
791362e9c1
commit
932178d203
2 changed files with 53 additions and 0 deletions
|
@ -8,6 +8,7 @@
|
||||||
use TgBotLib\Methods\AddStickerToSet;
|
use TgBotLib\Methods\AddStickerToSet;
|
||||||
use TgBotLib\Methods\AnswerCallbackQuery;
|
use TgBotLib\Methods\AnswerCallbackQuery;
|
||||||
use TgBotLib\Methods\AnswerInlineQuery;
|
use TgBotLib\Methods\AnswerInlineQuery;
|
||||||
|
use TgBotLib\Methods\AnswerShippingQuery;
|
||||||
use TgBotLib\Methods\AnswerWebAppQuery;
|
use TgBotLib\Methods\AnswerWebAppQuery;
|
||||||
use TgBotLib\Methods\ApproveChatJoinRequest;
|
use TgBotLib\Methods\ApproveChatJoinRequest;
|
||||||
use TgBotLib\Methods\BanChatMember;
|
use TgBotLib\Methods\BanChatMember;
|
||||||
|
@ -243,6 +244,7 @@
|
||||||
case SAVE_PREPARED_INLINE_MESSAGE = 'savePreparedInlineMessage';
|
case SAVE_PREPARED_INLINE_MESSAGE = 'savePreparedInlineMessage';
|
||||||
case SEND_INVOICE = 'sendInvoice';
|
case SEND_INVOICE = 'sendInvoice';
|
||||||
case CREATE_INVOICE_LINK = 'createInvoiceLink';
|
case CREATE_INVOICE_LINK = 'createInvoiceLink';
|
||||||
|
case ANSWER_SHIPPING_QUERY = 'answerShippingQuery';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Executes a command on the provided bot with the given parameters.
|
* Executes a command on the provided bot with the given parameters.
|
||||||
|
@ -374,6 +376,7 @@
|
||||||
self::SAVE_PREPARED_INLINE_MESSAGE => SavePreparedInlineMessage::execute($bot, $parameters),
|
self::SAVE_PREPARED_INLINE_MESSAGE => SavePreparedInlineMessage::execute($bot, $parameters),
|
||||||
self::SEND_INVOICE => SendInvoice::execute($bot, $parameters),
|
self::SEND_INVOICE => SendInvoice::execute($bot, $parameters),
|
||||||
self::CREATE_INVOICE_LINK => CreateInvoiceLink::execute($bot, $parameters),
|
self::CREATE_INVOICE_LINK => CreateInvoiceLink::execute($bot, $parameters),
|
||||||
|
self::ANSWER_SHIPPING_QUERY => AnswerShippingQuery::execute($bot, $parameters),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
50
src/TgBotLib/Methods/AnswerShippingQuery.php
Normal file
50
src/TgBotLib/Methods/AnswerShippingQuery.php
Normal file
|
@ -0,0 +1,50 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace TgBotLib\Methods;
|
||||||
|
|
||||||
|
use TgBotLib\Abstracts\Method;
|
||||||
|
use TgBotLib\Bot;
|
||||||
|
use TgBotLib\Enums\Methods;
|
||||||
|
use TgBotLib\Interfaces\ObjectTypeInterface;
|
||||||
|
|
||||||
|
class AnswerShippingQuery extends Method
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public static function execute(Bot $bot, array $parameters = []): true
|
||||||
|
{
|
||||||
|
if(isset($parameters['shipping_options']))
|
||||||
|
{
|
||||||
|
if($parameters['shipping_options'] instanceof ObjectTypeInterface)
|
||||||
|
{
|
||||||
|
$parameters['shipping_options'] = json_encode($parameters['shipping_options']->toArray());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return (bool)self::executeCurl(self::buildPost($bot, Methods::ANSWER_SHIPPING_QUERY->value, $parameters));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public static function getRequiredParameters(): ?array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'shipping_query_id',
|
||||||
|
'ok'
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public static function getOptionalParameters(): ?array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'shipping_options',
|
||||||
|
'error_message'
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue