From 71467461de6e7b421121f1b03cedc89234cfdcde Mon Sep 17 00:00:00 2001 From: Ceda EI Date: Sun, 17 Jun 2018 16:01:13 +0530 Subject: [PATCH] Improve /wiki --- webhook.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/webhook.php b/webhook.php index 7945b57..9313e34 100644 --- a/webhook.php +++ b/webhook.php @@ -167,7 +167,17 @@ function arch_wiki() } $url = "https://wiki.archlinux.org/api.php?action=opensearch&format=json&search=" . urlencode($search_query); $a = json_decode(file_get_contents($url)); - send_html("" . $a[1][0] . ""); + $names = $a[1]; + $urls = $a[3]; + if (count($names) == 0) { + send_text("No result found", true); + return false; + } + $text = "Results\n"; + for ($i = 0 ; $i < count($names) ; $i++){ + $text .= "" . $names[$i] . "\n"; + } + send_html($text); } function coin()