api(json-rpc): force stickers to be sent as stickers (#4819)

This approach uses a param field to enable forcing the sticker
`viewtype`. The first commit has the memory-only flag implemented, but
this flag is not persistent through the database conversion needed for
draft/undraft. That's why `param` has to be used.

follow up to #4814 
fixes #4739

---------

Co-authored-by: Septias <scoreplayer2000@gmail.comclear>
This commit is contained in:
Sebastian Klähn
2023-10-14 10:34:46 +02:00
committed by GitHub
parent 2775fd1fcf
commit 0751cc50b9
4 changed files with 61 additions and 1 deletions

View File

@@ -664,6 +664,12 @@ impl Message {
self.viewtype
}
/// Forces the message to **keep** [Viewtype::Sticker]
/// e.g the message will not be converted to a [Viewtype::Image].
pub fn force_sticker(&mut self) {
self.param.set_int(Param::ForceSticker, 1);
}
/// Returns the state of the message.
pub fn get_state(&self) -> MessageState {
self.state