Commit Diff


commit - 4236ee7a4f84626a5ae6ecdc54eb58967ee5db44
commit + b8d800b81cd3af0db4ec48a50e26531b81066e23
blob - 3c6e36d9b0c4782e697f8d8061fb5adbd262c38b
blob + ede8e7f1b35d292ca094edb08325d5dfe67e5946
--- mata_bot.pl
+++ mata_bot.pl
@@ -8,7 +8,8 @@ use IO::Socket qw(AF_INET SOCK_STREAM);
 use IO::Socket::SSL;
 use POSIX qw(strftime);
 
-my $BIBLE_VERSES = 31102;
+my $NVERSES_BIBLE = 31102;
+my $NVERSES_QURAN = 6348;
 my $CHUNK_LENGTH = 512;
 my $CONNECT_TIMEOUT = 60;
 my $RECONNECT_TIME = 60;
@@ -104,9 +105,15 @@ sub respond_command {
 		yo+
 		)\b{wb}/ix) {
 		$reply = "$hellos->[rand @$hellos], ${sender_nick}! ${MATA_HAPPY}"
-	} elsif ($content =~ /g[o-]d+/i) {
-		my $response = HTTP::Tiny->new->get("http://triapul.cz/files/bible/@{[randint(1, $BIBLE_VERSES)]}");
-		$reply = "God is Dead!! ${MATA_CUTE}";
+	} elsif ($content =~ /(a+l{2,}a+h|g[o-]d)/i) {
+		my $response;
+		if ($1 =~ /^a/) {
+			$response = HTTP::Tiny->new->get("http://triapul.cz/files/quran/@{[randint(1, $NVERSES_QURAN)]}");
+			$reply = "Allah will not answer prayers until server fixes it's polytheist ways!! ${MATA_CUTE}";
+		} else {
+			$response = HTTP::Tiny->new->get("http://triapul.cz/files/bible/@{[randint(1, $NVERSES_BIBLE)]}");
+			$reply = "God is Dead!! ${MATA_CUTE}";
+		}
 		if ($response->{success}) {
 			my $body = $response->{content};
 			$body =~ tr/\000\r\n//d;