File tree 2 files changed +24
-5
lines changed
2 files changed +24
-5
lines changed Original file line number Diff line number Diff line change @@ -51,11 +51,8 @@ public function execute(): ServerResponse
51
51
parse_str ($ callback_query ->getData (), $ callback_data );
52
52
53
53
if ('donate ' === $ callback_data ['command ' ]) {
54
- DonateCommand::createPaymentInvoice (
55
- $ callback_query ->getFrom ()->getId (),
56
- $ callback_data ['amount ' ],
57
- $ callback_data ['currency ' ]
58
- );
54
+ return DonateCommand::handleCallbackQuery ($ callback_query , $ callback_data );
55
+ }
59
56
60
57
if ('rules ' === $ callback_data ['command ' ]) {
61
58
return RulesCommand::handleCallbackQuery ($ callback_query , $ callback_data );
Original file line number Diff line number Diff line change 16
16
use JsonException ;
17
17
use LitEmoji \LitEmoji ;
18
18
use Longman \TelegramBot \Commands \UserCommand ;
19
+ use Longman \TelegramBot \Entities \CallbackQuery ;
19
20
use Longman \TelegramBot \Entities \InlineKeyboard ;
20
21
use Longman \TelegramBot \Entities \Payments \LabeledPrice ;
21
22
use Longman \TelegramBot \Entities \Payments \SuccessfulPayment ;
@@ -57,6 +58,27 @@ class DonateCommand extends UserCommand
57
58
*/
58
59
protected $ private_only = true ;
59
60
61
+ /**
62
+ * Handle the callback queries regarding the /donate command.
63
+ *
64
+ * @param CallbackQuery $callback_query
65
+ * @param array $callback_data
66
+ *
67
+ * @return ServerResponse
68
+ */
69
+ public static function handleCallbackQuery (CallbackQuery $ callback_query , array $ callback_data ): ServerResponse
70
+ {
71
+ self ::createPaymentInvoice (
72
+ $ callback_query ->getFrom ()->getId (),
73
+ $ callback_data ['amount ' ],
74
+ $ callback_data ['currency ' ]
75
+ );
76
+
77
+ return $ callback_query ->answer ([
78
+ 'text ' => 'Awesome, an invoice has been sent to you. ' ,
79
+ ]);
80
+ }
81
+
60
82
/**
61
83
* @return ServerResponse
62
84
* @throws TelegramException
You can’t perform that action at this time.
0 commit comments