Add pushMessageContentPremiumGiveaway.
This commit is contained in:
parent
ce5f63c5aa
commit
129a04b24d
@ -2810,7 +2810,7 @@ messageGiftedPremium gifter_user_id:int53 currency:string amount:int53 cryptocur
|
||||
//@code The gift code
|
||||
messagePremiumGiftCode creator_id:MessageSender is_from_giveaway:Bool month_count:int32 code:string = MessageContent;
|
||||
|
||||
//@description A Telegram Premium giveaway is scheduled by channel chats
|
||||
//@description A Telegram Premium giveaway was created
|
||||
//@parameters Giveaway parameters
|
||||
//@user_count Number of users which will receive Telegram Premium subscription gift codes
|
||||
//@month_count Number of month the Telegram Premium subscription will be active after code activation
|
||||
@ -4785,6 +4785,12 @@ pushMessageContentPoll question:string is_regular:Bool is_pinned:Bool = PushMess
|
||||
//@description A message with a Telegram Premium gift code created for the user @month_count Number of month the Telegram Premium subscription will be active after code activation
|
||||
pushMessageContentPremiumGiftCode month_count:int32 = PushMessageContent;
|
||||
|
||||
//@description A message with a Telegram Premium giveaway
|
||||
//@user_count Number of users which will receive Telegram Premium subscription gift codes; 0 for pinned message
|
||||
//@month_count Number of month the Telegram Premium subscription will be active after code activation; 0 for pinned message
|
||||
//@is_pinned True, if the message is a pinned message with the specified content
|
||||
pushMessageContentPremiumGiveaway user_count:int32 month_count:int32 is_pinned:Bool = PushMessageContent;
|
||||
|
||||
//@description A screenshot of a message in the chat has been taken
|
||||
pushMessageContentScreenshotTaken = PushMessageContent;
|
||||
|
||||
|
@ -2890,6 +2890,9 @@ string NotificationManager::convert_loc_key(const string &loc_key) {
|
||||
if (loc_key == "MESSAGE_GIFTCODE") {
|
||||
return "MESSAGE_GIFTCODE";
|
||||
}
|
||||
if (loc_key == "MESSAGE_GIVEAWAY") {
|
||||
return "MESSAGE_GIVEAWAY";
|
||||
}
|
||||
break;
|
||||
case 'H':
|
||||
if (loc_key == "PINNED_PHOTO") {
|
||||
@ -2903,6 +2906,9 @@ string NotificationManager::convert_loc_key(const string &loc_key) {
|
||||
if (loc_key == "PINNED_GIF") {
|
||||
return "PINNED_MESSAGE_ANIMATION";
|
||||
}
|
||||
if (loc_key == "PINNED_GIVEAWAY") {
|
||||
return "PINNED_MESSAGE_GIVEAWAY";
|
||||
}
|
||||
if (loc_key == "MESSAGE_INVOICE") {
|
||||
return "MESSAGE_INVOICE";
|
||||
}
|
||||
@ -3421,6 +3427,21 @@ Status NotificationManager::process_push_notification_payload(string payload, bo
|
||||
arg = PSTRING() << loc_args[1] << ' ' << loc_args[0];
|
||||
loc_args.clear();
|
||||
}
|
||||
if (loc_key == "MESSAGE_GIVEAWAY") {
|
||||
if (loc_args.size() != 2) {
|
||||
return Status::Error("Expected 2 arguments for MESSAGE_GIVEAWAY");
|
||||
}
|
||||
TRY_RESULT(user_count, to_integer_safe<int32>(loc_args[0]));
|
||||
if (user_count <= 0) {
|
||||
return Status::Error("Expected user count to be non-negative");
|
||||
}
|
||||
TRY_RESULT(month_count, to_integer_safe<int32>(loc_args[1]));
|
||||
if (month_count <= 0) {
|
||||
return Status::Error("Expected month count to be non-negative");
|
||||
}
|
||||
arg = PSTRING() << user_count << ' ' << month_count;
|
||||
loc_args.clear();
|
||||
}
|
||||
if (loc_args.size() > 1) {
|
||||
return Status::Error("Receive too many arguments");
|
||||
}
|
||||
|
@ -258,6 +258,18 @@ class NotificationTypePushMessage final : public NotificationType {
|
||||
int32 month_count = to_integer<int32>(arg);
|
||||
return td_api::make_object<td_api::pushMessageContentPremiumGiftCode>(month_count);
|
||||
}
|
||||
if (key == "MESSAGE_GIVEAWAY") {
|
||||
int32 user_count = 0;
|
||||
int32 month_count = 0;
|
||||
if (!is_pinned) {
|
||||
string user_count_str;
|
||||
string month_count_str;
|
||||
std::tie(user_count_str, month_count_str) = split(arg);
|
||||
user_count = to_integer<int32>(user_count_str);
|
||||
month_count = to_integer<int32>(month_count_str);
|
||||
}
|
||||
return td_api::make_object<td_api::pushMessageContentPremiumGiveaway>(user_count, month_count, is_pinned);
|
||||
}
|
||||
break;
|
||||
case 'I':
|
||||
if (key == "MESSAGE_INVOICE") {
|
||||
|
Loading…
Reference in New Issue
Block a user