add structure for `Oracles' (special answers depending on queries + a few implementations (#10)
incl. a calculator, a hash encoder + rot13 and b64!, and a "what time is it" with timezone selection frontend injected in $payload["left"] in web.php you can see this live [on my instance](https://4get.silly.computer/web?s=7%2B8(9%5E2)&scraper=brave&nsfw=yes) (there are some issues that aren't related to this PR. favicons, etc. I'll fix them later.) Reviewed-on: https://git.lolcat.ca/lolcat/4get/pulls/10 Co-authored-by: cynic <admin@cynic.moe> Co-committed-by: cynic <admin@cynic.moe>
This commit is contained in:
parent
d312674df7
commit
8762d68466
6 changed files with 349 additions and 0 deletions
24
oracles/base.php
Normal file
24
oracles/base.php
Normal file
|
@ -0,0 +1,24 @@
|
|||
<?php
|
||||
abstract class oracle {
|
||||
// some info to spit out alongside the result, so the user knows
|
||||
// what exactly is giving out the answer. prevents confusion
|
||||
// about what oracle is answering them for ambiguous queries.
|
||||
public $info = [
|
||||
"name" => "some oracle"
|
||||
];
|
||||
// this function should take in a query string search from $_GET,
|
||||
// and return a bool determining whether or not it is a question
|
||||
// intended for the oracle.
|
||||
public function check_query($q) {
|
||||
return false;
|
||||
}
|
||||
// produce the correct answer for the query using the oracle.
|
||||
// note: if it becomes apparent /during generation/ that the
|
||||
// query is not in fact for the oracle, returning an empty
|
||||
// string will kill the oracle pane.
|
||||
// answer format: ["ans1 title" => "ans1", ...]
|
||||
public function generate_response($q) {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
?>
|
Loading…
Add table
Add a link
Reference in a new issue