Add td_api::pushMessageContentPaidMedia.
This commit is contained in:
parent
0f4e9015e5
commit
9c4a509b99
@ -5718,6 +5718,11 @@ pushMessageContentInvoice price:string is_pinned:Bool = PushMessageContent;
|
||||
//@description A message with a location @is_live True, if the location is live @is_pinned True, if the message is a pinned message with the specified content
|
||||
pushMessageContentLocation is_live:Bool is_pinned:Bool = PushMessageContent;
|
||||
|
||||
//@description A message with paid media
|
||||
//@star_count Number of stars needed to buy access to the media in the message; 0 for pinned message
|
||||
//@is_pinned True, if the message is a pinned message with the specified content
|
||||
pushMessageContentPaidMedia star_count:int53 is_pinned:Bool = PushMessageContent;
|
||||
|
||||
//@description A photo message
|
||||
//@photo Message content; may be null
|
||||
//@caption Photo caption
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include "td/telegram/Photo.hpp"
|
||||
#include "td/telegram/SecretChatId.h"
|
||||
#include "td/telegram/ServerMessageId.h"
|
||||
#include "td/telegram/StarManager.h"
|
||||
#include "td/telegram/StateManager.h"
|
||||
#include "td/telegram/StoryId.h"
|
||||
#include "td/telegram/StoryManager.h"
|
||||
@ -2832,6 +2833,9 @@ string NotificationManager::convert_loc_key(const string &loc_key) {
|
||||
if (loc_key == "MESSAGE_AUDIO") {
|
||||
return "MESSAGE_VOICE_NOTE";
|
||||
}
|
||||
if (loc_key == "PINNED_PAID_MEDIA") {
|
||||
return "PINNED_MESSAGE_PAID_MEDIA";
|
||||
}
|
||||
break;
|
||||
case 'C':
|
||||
if (loc_key == "MESSAGE_CONTACT") {
|
||||
@ -2970,6 +2974,9 @@ string NotificationManager::convert_loc_key(const string &loc_key) {
|
||||
if (loc_key == "MESSAGE_POLL") {
|
||||
return "MESSAGE_POLL";
|
||||
}
|
||||
if (loc_key == "MESSAGE_PAID_MEDIA") {
|
||||
return "MESSAGE_PAID_MEDIA";
|
||||
}
|
||||
break;
|
||||
case 'Q':
|
||||
if (loc_key == "MESSAGE_QUIZ") {
|
||||
@ -3563,6 +3570,15 @@ Status NotificationManager::process_push_notification_payload(string payload, bo
|
||||
arg = PSTRING() << user_count << ' ' << month_count;
|
||||
loc_args.clear();
|
||||
}
|
||||
if (loc_key == "MESSAGE_PAID_MEDIA") {
|
||||
if (loc_args.size() != 1) {
|
||||
return Status::Error("Expected 1 argument for MESSAGE_PAID_MEDIA");
|
||||
}
|
||||
TRY_RESULT(star_count, to_integer_safe<int64>(loc_args[0]));
|
||||
star_count = StarManager::get_star_count(star_count);
|
||||
arg = to_string(star_count);
|
||||
loc_args.clear();
|
||||
}
|
||||
if (loc_args.size() > 1) {
|
||||
return Status::Error("Receive too many arguments");
|
||||
}
|
||||
|
@ -297,6 +297,13 @@ class NotificationTypePushMessage final : public NotificationType {
|
||||
if (key == "MESSAGE_POLL") {
|
||||
return td_api::make_object<td_api::pushMessageContentPoll>(arg, true, is_pinned);
|
||||
}
|
||||
if (key == "MESSAGE_PAID_MEDIA") {
|
||||
int64 star_count = 0;
|
||||
if (!is_pinned) {
|
||||
star_count = to_integer<int64>(arg);
|
||||
}
|
||||
return td_api::make_object<td_api::pushMessageContentPaidMedia>(star_count, is_pinned);
|
||||
}
|
||||
break;
|
||||
case 'Q':
|
||||
if (key == "MESSAGE_QUIZ") {
|
||||
|
Loading…
Reference in New Issue
Block a user