diff --git a/booksearch.py b/booksearch.py index 2f200a4..c97cf48 100644 --- a/booksearch.py +++ b/booksearch.py @@ -8,15 +8,15 @@ Licensed under GNU General Public License v2.0 import web def book(phenny, input): + query = (input.group(2) or "").lower().strip() + if not query: + return phenny.reply("Minetest Modding Book - https://rubenwardy.com/minetest_modding_book/") + uri = "https://rubenwardy.com/minetest_modding_book/sitemap.json" text, status = web.get(uri) text = str(text, 'utf-8') data = web.json(text) - query = (input.group(2) or "").lower().strip() - if not query: - return phenny.reply("Minetest Modding Book - https://rubenwardy.com/minetest_modding_book/") - for ele in data: title = ele["title"] desc = ele.get("description", "")