send from in spoilers without text
This commit is contained in:
		
							parent
							
								
									a46a703f7c
								
							
						
					
					
						commit
						c94df04eed
					
				| @ -36,17 +36,28 @@ fn check_percent(img: DynamicImage) -> (u8,u8) { | |||||||
|     (percent,white) |     (percent,white) | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | fn generate_from(msg: &Message, append_text: bool) -> String { | ||||||
|  |     let mut msg_from = get_alias(msg); | ||||||
|  |     if append_text { | ||||||
|  |         msg_from.push_str(": "); | ||||||
|  |     } | ||||||
|  |     msg_from = String::from("Mensaje de ") + &msg_from; | ||||||
|  |     msg_from | ||||||
|  | } | ||||||
|  | 
 | ||||||
| pub fn append_text(new_msg: MultipartRequest<SendPhoto>, old_msg: Message) -> MultipartRequest<SendPhoto> { | pub fn append_text(new_msg: MultipartRequest<SendPhoto>, old_msg: Message) -> MultipartRequest<SendPhoto> { | ||||||
|  |     let msg_from; | ||||||
|     match old_msg.caption() { |     match old_msg.caption() { | ||||||
|         Some(caption) => { |         Some(caption) => { | ||||||
|             let mut msg_from = get_alias(&old_msg); |             msg_from = generate_from(&old_msg, true); | ||||||
|             msg_from.push_str(": "); |  | ||||||
|             msg_from = String::from("Mensaje de ") + &msg_from; |  | ||||||
|             let from_offset = msg_from.encode_utf16().count(); |             let from_offset = msg_from.encode_utf16().count(); | ||||||
|             //new_msg.caption(caption).caption_entities(generate_entity_spoiler(caption.len())).has_spoiler(true)
 |             //new_msg.caption(caption).caption_entities(generate_entity_spoiler(caption.len())).has_spoiler(true)
 | ||||||
|             new_msg.caption(msg_from + caption).caption_entities(generate_captions(old_msg.caption_entities().unwrap().to_vec(),caption.encode_utf16().count(), from_offset)) |             new_msg.caption(msg_from + caption).caption_entities(generate_captions(old_msg.caption_entities().unwrap().to_vec(),caption.encode_utf16().count(), from_offset)) | ||||||
|         }, |         }, | ||||||
|         None => new_msg, |         None => { | ||||||
|  |             msg_from = generate_from(&old_msg, false); | ||||||
|  |             new_msg.caption(msg_from) | ||||||
|  |         }, | ||||||
|     } |     } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user