@@ -115,7 +115,7 @@ async fn get_custom_words_from_db(chat_id: i64) -> Option<String> {
115115}
116116
117117async fn handle_message < ' a > ( bot : & Bot , message : & Message ) -> Result < ( ) , HandlerError > {
118- let user = match message. from ( ) {
118+ let user = match & message. from {
119119 None => return Ok ( ( ) ) ,
120120 Some ( user) => user,
121121 } ;
@@ -189,7 +189,7 @@ async fn handle_message<'a>(bot: &Bot, message: &Message) -> Result<(), HandlerE
189189 if let Some ( custom_words) =
190190 get_custom_words_from_db ( message. chat . id . clone ( ) . 0 ) . await
191191 {
192- let _words = contains_in ( custom_words, String :: from ( data) ) ;
192+ let _words = contains_in ( custom_words, data) ;
193193 if !_words. is_empty ( ) {
194194 if let Ok ( content) = db_conn
195195 . get_random_content ( message. chat . id . 0 , true , _words)
@@ -217,7 +217,7 @@ async fn handle_message<'a>(bot: &Bot, message: &Message) -> Result<(), HandlerE
217217 if let Some ( custom_words) =
218218 get_custom_words_from_db ( message. chat . id . clone ( ) . 0 ) . await
219219 {
220- let _words = contains_in ( custom_words, String :: from ( data) ) ;
220+ let _words = contains_in ( custom_words, data) ;
221221 if !_words. is_empty ( ) {
222222 if let Ok ( content) = db_conn
223223 . get_random_content ( message. chat . id . 0 , false , _words)
@@ -551,7 +551,7 @@ impl Locale {
551551 /// Return: localized string or key
552552 fn get_tg ( & self , key : & str , msg : & Message ) -> String {
553553 let lang = & msg
554- . from ( )
554+ . from . clone ( )
555555 . and_then ( |u| u. language_code . clone ( ) )
556556 . unwrap_or ( String :: from ( "en" ) ) ;
557557 self . get ( & * format ! ( "tg_{}" , key) , lang. as_str ( ) )
0 commit comments