Add /wiki for wikipedia
This commit is contained in:
parent
71467461de
commit
a3464d866e
|
@ -3,7 +3,8 @@ word - Get a random word
|
||||||
words - Get n random words
|
words - Get n random words
|
||||||
kys - Kill yourself
|
kys - Kill yourself
|
||||||
coin - Tosses a coin
|
coin - Tosses a coin
|
||||||
wiki - search the Arch wiki
|
wiki - search Wikipedia
|
||||||
|
arch_wiki - search the Arch wiki
|
||||||
is - Is <your question>
|
is - Is <your question>
|
||||||
are - Are <your question>
|
are - Are <your question>
|
||||||
can - Can <your question>
|
can - Can <your question>
|
||||||
|
|
10
webhook.php
10
webhook.php
|
@ -151,7 +151,7 @@ function rand_question()
|
||||||
send_text($question);
|
send_text($question);
|
||||||
}
|
}
|
||||||
|
|
||||||
function arch_wiki()
|
function media_wiki($base_url)
|
||||||
{
|
{
|
||||||
global $command_list;
|
global $command_list;
|
||||||
$search_query = "";
|
$search_query = "";
|
||||||
|
@ -165,7 +165,7 @@ function arch_wiki()
|
||||||
send_text('Missing search query');
|
send_text('Missing search query');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$url = "https://wiki.archlinux.org/api.php?action=opensearch&format=json&search=" . urlencode($search_query);
|
$url = $base_url . "?action=opensearch&format=json&search=" . urlencode($search_query);
|
||||||
$a = json_decode(file_get_contents($url));
|
$a = json_decode(file_get_contents($url));
|
||||||
$names = $a[1];
|
$names = $a[1];
|
||||||
$urls = $a[3];
|
$urls = $a[3];
|
||||||
|
@ -271,9 +271,13 @@ $modules = array(
|
||||||
"command" => "/question",
|
"command" => "/question",
|
||||||
"function" => "rand_question();"
|
"function" => "rand_question();"
|
||||||
),
|
),
|
||||||
|
array(
|
||||||
|
"command" => "/arch_wiki",
|
||||||
|
"function" => "media_wiki('https://wiki.archlinux.org/api.php');"
|
||||||
|
),
|
||||||
array(
|
array(
|
||||||
"command" => "/wiki",
|
"command" => "/wiki",
|
||||||
"function" => "arch_wiki();"
|
"function" => "media_wiki('https://en.wikipedia.org/w/api.php');"
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
"command" => "/coin",
|
"command" => "/coin",
|
||||||
|
|
Loading…
Reference in New Issue