commit | author | age
|
8bd4d9
|
1 |
<?php |
JK |
2 |
class humor implements module { |
|
3 |
static function register_cmd() { |
|
4 |
return array( |
|
5 |
'humor' => 'cmd_humor', |
|
6 |
'kawal' => 'cmd_humor', |
|
7 |
'zart' => 'cmd_humor', |
|
8 |
'smieszne' => 'cmd_humor', |
|
9 |
'dowcip' => 'cmd_humor', |
|
10 |
); |
|
11 |
} |
|
12 |
|
|
13 |
static function cmd_humor($name, $args) { |
|
14 |
if(file_exists('./data/humor/humor.txt')) { |
|
15 |
GGapi::putText(file_get_contents('./data/humor/humor.txt')); |
|
16 |
} |
|
17 |
elseif(file_exists('./data/humor/humor.jpg')) { |
|
18 |
GGapi::putImage('./data/humor/humor.jpg'); |
|
19 |
} |
|
20 |
else |
|
21 |
{ |
|
22 |
$last = './data/humor/archiwum/'.date('d.m.Y', strtotime('-1 day')); |
|
23 |
if(file_exists($last.'.txt')) { |
|
24 |
GGapi::putText(file_get_contents($last.'.txt')); |
|
25 |
} |
|
26 |
elseif(file_exists($last.'.jpg')) { |
|
27 |
GGapi::putImage($last.'.jpg'); |
|
28 |
} |
|
29 |
else |
|
30 |
{ |
|
31 |
GGapi::putText('Dziś nie udało się pobrać danych - przepraszamy.'); |
|
32 |
} |
|
33 |
} |
|
34 |
} |
|
35 |
|
|
36 |
static function help($cmd = NULL) { |
|
37 |
if($cmd === NULL) { |
|
38 |
GGapi::putRichText('humor', TRUE); |
|
39 |
GGapi::putRichText("\n".' Coś humorystycznego'."\n"); |
|
40 |
} |
|
41 |
else |
|
42 |
{ |
|
43 |
GGapi::putRichText('humor', TRUE); |
|
44 |
GGapi::putRichText(' (alias: '); |
|
45 |
GGapi::putRichText('s, smieszne', TRUE); |
|
46 |
GGapi::putRichText(')'."\n".' Coś humorystycznego na dziś'); |
|
47 |
} |
|
48 |
} |
|
49 |
} |
|
50 |
?> |