Add SpecialStickerSetType::get_dice_emoji.

GitOrigin-RevId: 6f61536c84fdb19a743d9ed78d5bf514db04c353
This commit is contained in:
levlam 2020-04-19 21:21:17 +03:00
parent 0fe8cc5250
commit b698019f36
2 changed files with 13 additions and 3 deletions

View File

@ -16,6 +16,7 @@ string SpecialStickerSetType::animated_emoji() {
} }
string SpecialStickerSetType::animated_dice(const string &emoji) { string SpecialStickerSetType::animated_dice(const string &emoji) {
CHECK(!emoji.empty());
return PSTRING() << "animated_dice_sticker_set#" << emoji; return PSTRING() << "animated_dice_sticker_set#" << emoji;
} }
@ -35,13 +36,20 @@ SpecialStickerSetType::SpecialStickerSetType(
} }
} }
string SpecialStickerSetType::get_dice_emoji() const {
if (begins_with(type_, "animated_dice_sticker_set#")) {
return type_.substr(Slice("animated_dice_sticker_set#").size());
}
return string();
}
telegram_api::object_ptr<telegram_api::InputStickerSet> SpecialStickerSetType::get_input_sticker_set() const { telegram_api::object_ptr<telegram_api::InputStickerSet> SpecialStickerSetType::get_input_sticker_set() const {
if (type_ == "animated_emoji_sticker_set") { if (type_ == "animated_emoji_sticker_set") {
return telegram_api::make_object<telegram_api::inputStickerSetAnimatedEmoji>(); return telegram_api::make_object<telegram_api::inputStickerSetAnimatedEmoji>();
} }
if (begins_with(type_, "animated_dice_sticker_set#")) { auto emoji = get_dice_emoji();
return telegram_api::make_object<telegram_api::inputStickerSetDice>( if (!emoji.empty()) {
type_.substr(Slice("animated_dice_sticker_set#").size())); return telegram_api::make_object<telegram_api::inputStickerSetDice>(emoji);
} }
UNREACHABLE(); UNREACHABLE();

View File

@ -19,6 +19,8 @@ struct SpecialStickerSetType {
static string animated_dice(const string &emoji); static string animated_dice(const string &emoji);
string get_dice_emoji() const;
SpecialStickerSetType() = default; SpecialStickerSetType() = default;
explicit SpecialStickerSetType(const telegram_api::object_ptr<telegram_api::InputStickerSet> &input_sticker_set); explicit SpecialStickerSetType(const telegram_api::object_ptr<telegram_api::InputStickerSet> &input_sticker_set);