Add /get and #requirements to message.
This commit is contained in:
parent
ad8786da00
commit
f606bf329f
18
webhook.php
18
webhook.php
|
@ -93,7 +93,7 @@ function add_requirement() {
|
|||
$stmt->execute();
|
||||
$conn->close();
|
||||
send_html("Added to requirements");
|
||||
get_updated_req();
|
||||
edit_html(get_updated_req());
|
||||
}
|
||||
|
||||
function deposit(){
|
||||
|
@ -114,7 +114,7 @@ function deposit(){
|
|||
$stmt->execute();
|
||||
$conn->close();
|
||||
send_html("Deposited!");
|
||||
get_updated_req();
|
||||
edit_html(get_updated_req());
|
||||
}
|
||||
|
||||
function get_updated_req() {
|
||||
|
@ -126,15 +126,15 @@ function get_updated_req() {
|
|||
$sql = "SELECT name, quantity FROM req WHERE quantity > 0;";
|
||||
$result = $conn->query($sql);
|
||||
|
||||
$text = "";
|
||||
$text = "#requirements\n";
|
||||
if ($result->num_rows > 0) {
|
||||
while($row = $result->fetch_assoc()) {
|
||||
$text .= $row["name"] . " " . $row["quantity"] . "\n";
|
||||
}
|
||||
} else {
|
||||
$text = "Everything is complete";
|
||||
$text .= "Everything is complete";
|
||||
}
|
||||
edit_html($text);
|
||||
return $text;
|
||||
}
|
||||
|
||||
function everyone() {
|
||||
|
@ -147,6 +147,10 @@ function everyone() {
|
|||
send_html($text);
|
||||
}
|
||||
|
||||
function get_req() {
|
||||
send_html(get_updated_req());
|
||||
}
|
||||
|
||||
// Get JSON from post, store it and decode it.
|
||||
$var = file_get_contents('php://input');
|
||||
$decoded = json_decode($var);
|
||||
|
@ -174,6 +178,10 @@ $modules = array(
|
|||
array(
|
||||
"command" => "/everyone",
|
||||
"function" => "everyone();"
|
||||
),
|
||||
array(
|
||||
"command" => "/get",
|
||||
"function" => "get_req();"
|
||||
)
|
||||
);
|
||||
|
||||
|
|
Loading…
Reference in New Issue