@@ -15,7 +15,13 @@ def start(bot, update):
15
15
<b>Commands</b> \
16
16
\n /search -keyword- -- Search books by title' , parse_mode = ParseMode .HTML )
17
17
18
- def fetch (bot , update , ** kwargs ):
18
+
19
+ def search_or_fetch (bot , update , ** args ):
20
+ if update .effective_message .text .startswith ('/get' ): return fetch (bot , update , args )
21
+
22
+ search (bot , update , args )
23
+
24
+ def fetch (bot , update , args ):
19
25
md5 = update .effective_message .text [4 :]
20
26
url = api .fetch (md5 )
21
27
bot .send_chat_action (chat_id = update .message .chat_id , action = ChatAction .TYPING )
@@ -26,11 +32,10 @@ def emojize_book_list(books):
26
32
27
33
def search (bot , update , args ):
28
34
bot .send_chat_action (chat_id = update .message .chat_id , action = ChatAction .TYPING )
29
- results = api .search (' ' . join ( args ) )
35
+ results = api .search (update . message . text )
30
36
bot .send_message (chat_id = update .message .chat_id , text = (emojize_book_list (results ) if results else 'Oops, no results found!!' ), parse_mode = ParseMode .HTML )
31
37
32
38
def search_with_out_command (bot , update ):
33
39
bot .send_chat_action (chat_id = update .message .chat_id , action = ChatAction .TYPING )
34
40
results = api .search (update .message .text )
35
41
bot .send_message (chat_id = update .message .chat_id , text = (emojize_book_list (results ) if results else 'Oops, no results found!!' ), parse_mode = ParseMode .HTML )
36
-
0 commit comments