@@ -1937,7 +1937,7 @@ impl CommandApi {
1937
1937
let ctx = self . get_context ( account_id) . await ?;
1938
1938
1939
1939
let mut msg = Message :: new ( Viewtype :: Sticker ) ;
1940
- msg. set_file ( & sticker_path, None ) ;
1940
+ msg. set_file_and_deduplicate ( ctx , & sticker_path, None , None ) ;
1941
1941
1942
1942
// JSON-rpc does not need heuristics to turn [Viewtype::Sticker] into [Viewtype::Image]
1943
1943
msg. force_sticker ( ) ;
@@ -2163,6 +2163,7 @@ impl CommandApi {
2163
2163
chat_id : u32 ,
2164
2164
text : Option < String > ,
2165
2165
file : Option < String > ,
2166
+ filename : Option < String > ,
2166
2167
location : Option < ( f64 , f64 ) > ,
2167
2168
quoted_message_id : Option < u32 > ,
2168
2169
) -> Result < ( u32 , MessageObject ) > {
@@ -2174,7 +2175,7 @@ impl CommandApi {
2174
2175
} ) ;
2175
2176
message. set_text ( text. unwrap_or_default ( ) ) ;
2176
2177
if let Some ( file) = file {
2177
- message. set_file ( file, None ) ;
2178
+ message. set_file_and_deduplicate ( & ctx , file, filename , None ) ;
2178
2179
}
2179
2180
if let Some ( ( latitude, longitude) ) = location {
2180
2181
message. set_location ( latitude, longitude) ;
@@ -2208,6 +2209,7 @@ impl CommandApi {
2208
2209
chat_id : u32 ,
2209
2210
text : Option < String > ,
2210
2211
file : Option < String > ,
2212
+ filename : Option < String > ,
2211
2213
quoted_message_id : Option < u32 > ,
2212
2214
view_type : Option < MessageViewtype > ,
2213
2215
) -> Result < ( ) > {
@@ -2224,7 +2226,7 @@ impl CommandApi {
2224
2226
) ) ;
2225
2227
draft. set_text ( text. unwrap_or_default ( ) ) ;
2226
2228
if let Some ( file) = file {
2227
- draft. set_file ( file, None ) ;
2229
+ draft. set_file_and_deduplicate ( & ctx , file, filename , None ) ;
2228
2230
}
2229
2231
if let Some ( id) = quoted_message_id {
2230
2232
draft
0 commit comments