| Conditions | 3 |
| Total Lines | 15 |
| Code Lines | 15 |
| Lines | 15 |
| Ratio | 100 % |
| Changes | 0 | ||
| 1 | #by Linaname |
||
| 15 | View Code Duplication | @logging_decorator("gelbooru") |
|
|
|
|||
| 16 | def gelbooru_search(bot, update, args): |
||
| 17 | update.message.chat.send_action(ChatAction.UPLOAD_PHOTO) |
||
| 18 | query = " ".join(args) |
||
| 19 | try: |
||
| 20 | direct_link, page_link = get_image(query) |
||
| 21 | except: |
||
| 22 | update.message.reply_text("Sorry, something went wrong!") |
||
| 23 | return |
||
| 24 | if direct_link is None: |
||
| 25 | update.message.reply_text("Nothing found!") |
||
| 26 | return |
||
| 27 | msg_text = "[Image]({})".format(direct_link) + "\n" + "[View post]({})".format(page_link) |
||
| 28 | update.message.reply_text(msg_text, parse_mode="Markdown") |
||
| 29 | return(query) |
||
| 30 | |||
| 49 |