Add /insult. Refactor code.

This commit is contained in:
Ceda EI 2018-08-14 14:02:56 +05:30
parent 967bfbef68
commit e0d58a79de
2 changed files with 78 additions and 58 deletions

View File

@ -1,31 +1,30 @@
Owww ... Such a stupid idiot.
Don't drink and type.
I think you should go home or better a mental asylum.
Command not found. Just like your brain.
Do you realize you are making a fool of yourself? Apparently not.
You can type better than that.
Bot rule 544 section 9 prevents me from replying to stupid humans like you.
Sorry, we do not sell brains.
Believe me you are not normal.
I bet your brain feels as good as new, seeing that you never use it.
If I wanted to kill myself I'd climb your ego and jump to your IQ.
Zombies eat brains... you're safe.
You didn't evolve from apes, they evolved from you.
Come back and talk to me when your I.Q. exceeds your age.
I'm not saying you're stupid, I'm just saying you've got bad luck when it comes to thinking.
What language are you speaking? Cause it sounds like bullshit.
Stupidity is not a crime so you are free to go.
You are proof that evolution CAN go in reverse.
I would ask you how old you are but I know you can't count that high.
As an outsider, what do you think of the human race?
Brains aren't everything. In your case they're nothing.
Ordinarily people live and learn. You just live.
I don't know what makes you so stupid, but it really works.
Keep talking, someday you'll say something intelligent! (I doubt it though)
Shock me, say something intelligent.
Your IQ's lower than your shoe size.
Alas! Your neurotransmitters are no more working.
Are you crazy you fool.
Everyone has the right to be stupid but you are abusing the privilege.
I'm sorry I hurt your feelings when I called you stupid. I thought you already knew that.
##name## don't drink and type.
I think ##name## should go home or better a mental asylum.
Command not found. Just like ##name##'s brain.
##name## do you realize you are making a fool of yourself? Apparently not.
##name##, you can type better than that.
Bot rule 544 section 9 prevents me from replying to stupid humans like ##name##.
##name## sorry, we do not sell brains.
##name## believe me you are not normal.
##name## I bet your brain feels as good as new, seeing that you never use it.
If I wanted to kill myself I'd climb ##name##'s ego and jump to your IQ.
Zombies eat brains... ##name## is safe.
##name## didn't evolve from apes, they evolved from ##name##.
##name## come back and talk to me when your I.Q. exceeds your age.
##name## i'm not saying you're stupid, I'm just saying you've got bad luck when it comes to thinking.
##name## what language are you speaking? Cause it sounds like bullshit.
##name## stupidity is not a crime so you are free to go.
##name## is proof that evolution CAN go in reverse.
I would ask ##name## how old they are but I know they can't count that high.
As an outsider ##name##, what do you think of the human race?
##name## brains aren't everything. In your case they're nothing.
Ordinarily people live and learn. ##name## just lives.
##name## I don't know what makes you so stupid, but it really works.
##name## keep talking, someday you'll say something intelligent! (I doubt it though)
##name## Shock me, say something intelligent.
##name##'s IQ's lower than their shoe size.
Alas! ##name##'s neurotransmitters are no more working.
##name## are you crazy you fool.
Everyone has the right to be stupid but ##name## is abusing the privilege.
##name## I'm sorry I hurt your feelings when I called you stupid. I thought you already knew that.

View File

@ -120,18 +120,6 @@ function send_gif($gif_url, $reply=false) {
return $result;
}
// Returns Insults
function get_insults($username) {
global $decoded;
if ($decoded->{"message"}->{"from"}->{"id"} == 394312580){
return "Sorry master, I am unable to do that.";
}
else {
$insults = file('insults.txt');
return $insults[rand(0,count($insults)-1)];
}
}
// Generates random words
function rand_words($onewordmode) {
global $command_list;
@ -156,19 +144,17 @@ function rand_words($onewordmode) {
send_text(implode(' ', $words));
}
else {
send_text(get_insults());
send_text("Ever heard of numbers?", true);
}
}
function rand_question()
{
function rand_question() {
$questions = file('rand_questions.txt');
$question = $questions[rand(0,count($questions))];
send_text($question);
}
function media_wiki($base_url)
{
function media_wiki($base_url) {
global $command_list;
$search_query = "";
for ($i=1; $i < count($command_list); $i++) {
@ -196,8 +182,7 @@ function media_wiki($base_url)
send_html($text);
}
function coin()
{
function coin() {
$random = rand(0,1);
if ($random == 1) {
send_text('Heads', true);
@ -221,8 +206,7 @@ function get_gif($force) {
return $image_url;
}
function yes_or_no()
{
function yes_or_no() {
global $command_list;
if (!isset($command_list[1])){
send_text('You know, you also have to ask the question.', true);
@ -281,10 +265,48 @@ function kys() {
}
}
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 or run /kys username/name.", true);
}
}
// Insult
function send_insult() {
global $decoded;
global $bot_name;
global $command_list;
$insults = file('insults.txt');
$random_insult = $insults[rand(0,count($insults)-1)];
if ($decoded->{'message'}->{'reply_to_message'}->{'from'}->{'username'} == $bot_name){
send_text("Watch who you talk to.", true);
return;
}
if (isset($decoded->{'message'}->{'reply_to_message'})) {
if (isset($decoded->{'message'}->{'reply_to_message'}->{'from'}->{'username'})){
$username = '@' . $decoded->{'message'}->{'reply_to_message'}->{'from'}->{'username'};
$random_insult = preg_replace('/##name##/', $username, $random_insult);
}
else {
$first_name = $decoded->{'message'}->{'reply_to_message'}->{'from'}->{'first_name'};
$random_insult = preg_replace('/##name##/', $first_name, $random_insult);
}
send_text($random_insult);
}
elseif (isset($command_list[1])){
$username = $command_list[1];
if ($username == "@quadnite_bot" || $username == "Quadnite" || $username == "quadnite"){
send_text("Watch who you talk to.", true);
}
else {
$random_insult = preg_replace('/##name##/', $username, $random_insult);
send_text($random_insult);
}
}
else {
send_text("Do you want to insult yourself?\n\nIf no, reply to someone with /insult to insult them or run /insult username/name.", true);
}
}
// Sends back JSON
function json() {
global $var;
@ -293,7 +315,7 @@ function json() {
}
// Start Message
function start() {
send_text('Hi, I am Quadnite. If you are chatting with me in private, you are most likely doing it wrong. Add me to a group for fun. Do not promote me to an admin or I WILL hate you.');
send_text('Hi, I am Quadnite. If you are chatting with me in private, you are most likely doing it wrong. Add me to a group for fun.');
}
function help() {
@ -387,6 +409,10 @@ $modules = array(
array(
"command" => "/help",
"function" => "help();"
),
array(
"command" => "/insult",
"function" => "send_insult();"
)
);
@ -406,9 +432,4 @@ foreach ($modules as $module ) {
exit();
}
}
// If message is a reply, exit
if (isset($decoded->{"message"}->{"reply_to_message"})) {
exit();
}
?>