Remove legacy code. Remove default insulting. Allow param to /kys
This commit is contained in:
parent
67cf9a6b61
commit
39b25478d4
21
webhook.php
21
webhook.php
|
@ -106,16 +106,6 @@ function get_insults($username) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Logs Intruder
|
|
||||||
function intruder() {
|
|
||||||
global $decoded;
|
|
||||||
$text = "id: " . $chat_id . "first name" . $decoded->{"message"}->{"chat"}->{"first_name"} . "\n";
|
|
||||||
$file=fopen('attempter','a');
|
|
||||||
fwrite($file,$text);
|
|
||||||
fclose($file);
|
|
||||||
send_text("You are not authorized to view the commits. Contact @ceda_ei for details");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Generates random words
|
// Generates random words
|
||||||
function rand_words($onewordmode) {
|
function rand_words($onewordmode) {
|
||||||
global $command_list;
|
global $command_list;
|
||||||
|
@ -211,6 +201,7 @@ function yes_or_no()
|
||||||
function kys() {
|
function kys() {
|
||||||
global $decoded;
|
global $decoded;
|
||||||
global $bot_name;
|
global $bot_name;
|
||||||
|
global $command_list;
|
||||||
$kys = file('kys.txt');
|
$kys = file('kys.txt');
|
||||||
$random_kys = $kys[rand(0,count($kys)-1)];
|
$random_kys = $kys[rand(0,count($kys)-1)];
|
||||||
if ($decoded->{'message'}->{'reply_to_message'}->{'from'}->{'username'} == $bot_name){
|
if ($decoded->{'message'}->{'reply_to_message'}->{'from'}->{'username'} == $bot_name){
|
||||||
|
@ -228,6 +219,11 @@ function kys() {
|
||||||
}
|
}
|
||||||
send_text($random_kys);
|
send_text($random_kys);
|
||||||
}
|
}
|
||||||
|
elseif (isset($command_list[1])){
|
||||||
|
$username = $command_list[1];
|
||||||
|
$random_kys = preg_replace('/##name##/', $username, $random_kys);
|
||||||
|
send_text($random_kys);
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
send_text("Do you want to kill yourself?\n\nIf no, reply to someone with /kys to kill them.", true);
|
send_text("Do you want to kill yourself?\n\nIf no, reply to someone with /kys to kill them.", true);
|
||||||
}
|
}
|
||||||
|
@ -250,9 +246,6 @@ function help() {
|
||||||
|
|
||||||
// Get JSON from post, store it and decode it.
|
// Get JSON from post, store it and decode it.
|
||||||
$var = file_get_contents('php://input');
|
$var = file_get_contents('php://input');
|
||||||
$json = fopen('json', "w");
|
|
||||||
fwrite($json, $var);
|
|
||||||
fclose($json);
|
|
||||||
$decoded = json_decode($var);
|
$decoded = json_decode($var);
|
||||||
|
|
||||||
// Store the chat ID
|
// Store the chat ID
|
||||||
|
@ -362,6 +355,4 @@ foreach ($modules as $module ) {
|
||||||
if (isset($decoded->{"message"}->{"reply_to_message"})) {
|
if (isset($decoded->{"message"}->{"reply_to_message"})) {
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
send_text(get_insults(), true);
|
|
||||||
?>
|
?>
|
||||||
|
|
Loading…
Reference in New Issue