瀏覽代碼

some misc. oracles stuff (fixes/features) (#15)

fix a small calc.php bug, and add date information to the time module. the changes have been sitting on a branch for like a week, so I figured I'd cherry-pick them over to this branch for a PR.
[as always, these changes are live on my instance.](https://4get.silly.computer/web?s=what+is+the+date&scraper=yandex&nsfw=yes)

Reviewed-on: https://git.lolcat.ca/lolcat/4get/pulls/15
Co-authored-by: cynic <admin@cynic.moe>
Co-committed-by: cynic <admin@cynic.moe>
cynic 2 年之前
父節點
當前提交
24cfc5136e
共有 2 個文件被更改,包括 3 次插入2 次删除
  1. 1 1
      oracles/calc.php
  2. 2 1
      oracles/time.php

+ 1 - 1
oracles/calc.php

@@ -118,7 +118,7 @@ class calculator extends oracle {
 		if (count($tokens) > 0 && $tokens[0][0] == "o" || $tokens[count($tokens)-1][0] == "o") {
 			throw new Exception("Error Processing Request", 1);
 		}
-		if (in_array(["g", "("], $tokens)) {
+		while (in_array(["g", "("], $tokens)) {
 			$first_open = array_search(["g", "("], $tokens);
 			$enclosedality = 1;
 			for ($i = $first_open+1; $i < count($tokens); $i++) {

+ 2 - 1
oracles/time.php

@@ -8,7 +8,7 @@ class time extends oracle {
 		$prompts = [
 			"what", "time", "is", "it",
 			"right", "now", "the", "current",
-			"get"
+			"get", "date"
 		];
 		$q = str_replace(",", "", $q);
 		$q = str_replace("?", "", $q);
@@ -37,6 +37,7 @@ class time extends oracle {
 		date_default_timezone_set($timezone);
 		return [
 			"The time in ".$timezone => date("H:i:s"),
+			" " => date("l, F jS"),
 			"" => "include the string \"tz:XXX\" to use timezone XXX"
 		];
 	}