├── .gitattributes
├── .gitignore
├── README.md
├── README.old
├── bot.conf
├── bot.php
├── changes.txt
├── chat.php
├── checkbot.sh
├── command_reference.txt
├── connection.php
├── databases
├── ini.php
├── mysql.php
├── postgre.php
└── postgres.php
├── dcc.php
├── defines.php
├── error.php
├── file.php
├── function.conf
├── gpl.txt
├── includes
├── functions.php
└── sphinxapi.class.php
├── install.txt
├── irc.php
├── launch.sh
├── module.php
├── modules
├── bad_words
│ ├── bad_words.conf
│ ├── bad_words.ini
│ └── bad_words_mod.php
├── banip
│ ├── banip_mod.conf
│ └── banip_mod.php
├── bash
│ ├── bash_mod.conf
│ └── bash_mod.php
├── blackjack
│ ├── blackjack_mod.conf
│ └── blackjack_mod.php
├── default
│ ├── ads.ini
│ ├── dcc_mod.conf
│ ├── dcc_mod.php
│ ├── priv_mod.conf
│ └── priv_mod.php
├── fileserver
│ ├── extra.php
│ ├── fileserver.conf
│ └── fileserver.php
├── github
│ ├── github_mod.conf
│ └── github_mod.php
├── httpd
│ ├── htdocs
│ │ └── index.html
│ ├── http.ini
│ ├── httpd_mod.conf
│ └── httpd_mod.php
├── imdb
│ ├── imdb_mod.conf
│ └── imdb_mod.php
├── joke
│ ├── joke_mod.conf
│ └── joke_mod.php
├── more_mods.txt
├── news
│ ├── news_mod.conf
│ └── news_mod.php
├── peak_mod
│ ├── peak_mod.conf
│ └── peak_mod.php
├── perform
│ ├── perform_mod.conf
│ └── perform_mod.php
├── quotes_ini
│ ├── quote_mod.conf
│ └── quotes_mod.php
├── quotes_sql
│ ├── quote_mod.conf
│ └── quotes_mod.php
├── seen
│ ├── seen_mod.conf
│ └── seen_mod.php
├── serve
│ ├── serve_mod.conf
│ ├── serve_mod.php
│ └── shcema.sql
├── socketexample
│ ├── socketexample.conf
│ └── socketexample.php
├── template.txt
├── uptime
│ ├── uptime_mod.conf
│ └── uptime_mod.php
└── urlreveal
│ ├── urlreveal.conf
│ └── urlreveal.php
├── parser.php
├── queue.php
├── quickinstall.txt
├── remote.php
├── socket.php
├── start.cmd
├── start.sh
├── startb.sh
├── timers.php
├── typedefs.conf
├── untestedmods
├── Half_Life_RCON_0_1
│ ├── hlserver.conf
│ ├── hlserver.ini
│ ├── hlserver.php
│ └── readme.md
├── Shoutcast_Status_1_04
│ ├── readme.md
│ ├── shoutcast_status.class.php
│ ├── shoutcast_status.conf
│ └── shoutcast_status.php
├── Werewolf_Game_Version_0_9b
│ ├── readme.md
│ ├── werewolf.conf
│ └── werewolf.php
├── autorss
│ ├── autorss.conf
│ ├── autorss.ini
│ ├── autorss.php
│ ├── readme.md
│ └── simplepie.inc
├── bcalc_mod
│ ├── bcalc_mod.conf
│ ├── bcalc_mod.php
│ └── readme.md
├── bottalk
│ ├── README.md
│ ├── bottalk.conf
│ └── bottalk.php
├── chopper_ini
│ ├── chopper_mod.conf
│ ├── chopper_mod.php
│ ├── hosts.ini
│ └── readme.md
├── commands_mod_0_2
│ ├── commands_mod.conf
│ ├── commands_mod.php
│ └── readme.md
├── dice
│ ├── dice_mod.conf
│ ├── dice_mod.php
│ └── readme.md
├── gamefaqs.com
│ ├── gamefaqs_mod.conf
│ ├── gamefaqs_mod.php
│ └── readme.md
├── google_search
│ ├── google_search.conf
│ ├── google_search.php
│ └── readme.md
├── httpdext
│ ├── http.ini
│ ├── httpd_extra.php
│ ├── httpd_mod.conf
│ ├── httpd_mod.php
│ └── readme.md
├── iphp
│ ├── README.md
│ ├── iphp_config.php
│ ├── iphp_mod.conf
│ └── iphp_mod.php
├── leo_mod
│ ├── leo_mod.conf
│ ├── leo_mod.php
│ └── readme.md
├── m_autoop
│ ├── m_autoop.conf
│ ├── m_autoop.php
│ └── readme.md
├── m_invite_0.2
│ ├── m_invite.conf
│ ├── m_invite.php
│ └── readme.md
├── m_invite_2.0.3
│ ├── m_invite.conf
│ ├── m_invite.php
│ └── readme.md
├── magic8ball
│ ├── magic8ball.conf
│ ├── magic8ball.php
│ └── readme.md
├── musicbrainz_mod
│ ├── README.md
│ ├── musicbrainz.conf
│ ├── musicbrainz_mod.php
│ └── php-musicbrainz
│ │ ├── COPYING
│ │ ├── class_rdf_parser.php
│ │ ├── phpBrainz.class.php
│ │ └── rdfParser.php
├── omgzold_en
│ ├── omgzold.conf
│ ├── omgzold_mod.php
│ └── readme.md
├── php_eval
│ ├── Lincense.txt
│ ├── README.md
│ ├── php_eval.conf
│ └── php_eval.php
├── pizzatimer
│ ├── pizzatimer.conf
│ ├── pizzatimer.php
│ └── readme.md
├── readme.md
├── rss_feed_parser
│ ├── readme.md
│ ├── rss.ini
│ ├── rss_mod.conf
│ ├── rss_mod.php
│ └── rss_mod.tpl
├── sc_mod
│ ├── readme.md
│ ├── sc_mod.conf
│ └── sc_mod.php
├── slap
│ ├── readme.md
│ ├── slap_mod.conf
│ ├── slap_mod.php
│ └── slaps.ini
├── source_rcon
│ ├── admins.php
│ ├── defines.php
│ ├── readme.md
│ ├── settings.php
│ ├── source_rcon.conf
│ └── source_rcon.php
├── spotify_lookup
│ ├── readme.md
│ ├── spot_mod.conf
│ └── spot_mod.php
├── throw
│ ├── readme.md
│ ├── throw_mod.conf
│ └── throw_mod.php
├── tld_mod
│ ├── readme.md
│ ├── tld_mod.conf
│ ├── tld_mod.ini
│ └── tld_mod.php
├── twittertopic
│ ├── readme.md
│ ├── status.txt
│ ├── topic.txt
│ ├── twittertopic.conf
│ └── twittertopic.php
├── webget
│ ├── ftp.php
│ ├── readme.md
│ ├── wget_mod.conf
│ └── wget_mod.php
├── wp_mod
│ ├── readme.md
│ ├── userparse.inc
│ ├── whatpulse.inc
│ ├── wp_mod.conf
│ ├── wp_mod.php
│ └── xmlerror
└── wwdicemod
│ ├── gpl.txt
│ ├── readme.md
│ ├── wwdice_mod.conf
│ └── wwdice_mod.php
└── website.txt
/.gitattributes:
--------------------------------------------------------------------------------
1 | *.doc diff=astextplain
2 | *.DOC diff=astextplain
3 | *.docx diff=astextplain
4 | *.DOCX diff=astextplain
5 | *.dot diff=astextplain
6 | *.DOT diff=astextplain
7 | *.pdf diff=astextplain
8 | *.PDF diff=astextplain
9 | *.rtf diff=astextplain
10 | *.RTF diff=astextplain
11 |
12 | *.jpg binary
13 | *.png binary
14 | *.gif binary
15 |
16 | *.cs text=auto diff=csharp
17 | *.vb text=auto
18 | *.c text=auto
19 | *.cpp text=auto
20 | *.cxx text=auto
21 | *.h text=auto
22 | *.hxx text=auto
23 | *.py text=auto
24 | *.rb text=auto
25 | *.java text=auto
26 | *.html text=auto
27 | *.htm text=auto
28 | *.css text=auto
29 | *.scss text=auto
30 | *.sass text=auto
31 | *.less text=auto
32 | *.js text=auto
33 | *.lisp text=auto
34 | *.clj text=auto
35 | *.sql text=auto
36 | *.php text=auto
37 | *.lua text=auto
38 | *.m text=auto
39 | *.asm text=auto
40 | *.erl text=auto
41 | *.fs text=auto
42 | *.fsx text=auto
43 | *.hs text=auto
44 |
45 | *.csproj text=auto merge=union
46 | *.vbproj text=auto merge=union
47 | *.fsproj text=auto merge=union
48 | *.dbproj text=auto merge=union
49 | *.sln text=auto eol=crlf merge=union
50 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 |
2 | #################
3 | ## Eclipse
4 | #################
5 |
6 | *.pydevproject
7 | .project
8 | .metadata
9 | bin/**
10 | tmp/**
11 | tmp/**/*
12 | *.tmp
13 | *.bak
14 | *.swp
15 | *~.nib
16 | local.properties
17 | .classpath
18 | .settings/
19 | .loadpath
20 |
21 | # External tool builders
22 | .externalToolBuilders/
23 |
24 | # Locally stored "Eclipse launch configurations"
25 | *.launch
26 |
27 | # CDT-specific
28 | .cproject
29 |
30 | # PDT-specific
31 | .buildpath
32 |
33 |
34 | #################
35 | ## Visual Studio
36 | #################
37 |
38 | ## Ignore Visual Studio temporary files, build results, and
39 | ## files generated by popular Visual Studio add-ons.
40 |
41 | # User-specific files
42 | *.suo
43 | *.user
44 | *.sln.docstates
45 |
46 | # Build results
47 | **/[Dd]ebug/
48 | **/[Rr]elease/
49 | *_i.c
50 | *_p.c
51 | *.ilk
52 | *.meta
53 | *.obj
54 | *.pch
55 | *.pdb
56 | *.pgc
57 | *.pgd
58 | *.rsp
59 | *.sbr
60 | *.tlb
61 | *.tli
62 | *.tlh
63 | *.tmp
64 | *.vspscc
65 | .builds
66 | **/*.dotCover
67 |
68 | ## TODO: If you have NuGet Package Restore enabled, uncomment this
69 | #**/packages/
70 |
71 | # Visual C++ cache files
72 | ipch/
73 | *.aps
74 | *.ncb
75 | *.opensdf
76 | *.sdf
77 |
78 | # Visual Studio profiler
79 | *.psess
80 | *.vsp
81 |
82 | # ReSharper is a .NET coding add-in
83 | _ReSharper*
84 |
85 | # Installshield output folder
86 | [Ee]xpress
87 |
88 | # DocProject is a documentation generator add-in
89 | DocProject/buildhelp/
90 | DocProject/Help/*.HxT
91 | DocProject/Help/*.HxC
92 | DocProject/Help/*.hhc
93 | DocProject/Help/*.hhk
94 | DocProject/Help/*.hhp
95 | DocProject/Help/Html2
96 | DocProject/Help/html
97 |
98 | # Click-Once directory
99 | publish
100 |
101 | # Others
102 | [Bb]in
103 | [Oo]bj
104 | sql
105 | TestResults
106 | *.Cache
107 | ClientBin
108 | stylecop.*
109 | ~$*
110 | *.dbmdl
111 | Generated_Code #added for RIA/Silverlight projects
112 |
113 | # Backup & report files from converting an old project file to a newer
114 | # Visual Studio version. Backup files are not needed, because we have git ;-)
115 | _UpgradeReport_Files/
116 | Backup*/
117 | UpgradeLog*.XML
118 |
119 |
120 |
121 | ############
122 | ## Windows
123 | ############
124 |
125 | # Windows image file caches
126 | Thumbs.db
127 |
128 | # Folder config file
129 | Desktop.ini
130 |
131 |
132 | #############
133 | ## Python
134 | #############
135 |
136 | *.py[co]
137 |
138 | # Packages
139 | *.egg
140 | *.egg-info
141 | dist
142 | build
143 | eggs
144 | parts
145 | bin
146 | var
147 | sdist
148 | develop-eggs
149 | .installed.cfg
150 |
151 | # Installer logs
152 | pip-log.txt
153 |
154 | # Unit test / coverage reports
155 | .coverage
156 | .tox
157 |
158 | #Translations
159 | *.mo
160 |
161 | #Mr Developer
162 | .mr.developer.cfg
163 |
164 | # Mac crap
165 | .DS_Store
166 |
167 | ################
168 | ## other stuff
169 | ################
170 | *.log
171 | seen.ini
172 | peak.ini
173 |
174 | ################
175 | ## Own Crap
176 | ################
177 | includes/myfunctions.php
178 | layer13test.conf
179 | .git/*
180 | .idea/*
181 | #priv modules
182 | modules/g2dev/*
183 | modules/g2pre/*
184 | modules/g2trace/*
185 | modules/AutoDL/*
186 | modules/l13convert/*
187 | cookies/*
188 | testing.php
189 | #conf files
190 | layer13.conf
191 | layer13function.conf
192 | l13a.conf
193 | l13d.conf
194 | l13c.conf
195 | l13afunctions.conf
196 | l13cfunctions.conf
197 | l13dfunctions.conf
198 | launch.sh
199 | modules/g2perform/
200 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | ### quick instruction until i get a new readme written
2 |
3 | fastest way to get the bot up and running:
4 | ```
5 | sudo apt-get install git
6 | git clone https://github.com/g2x3k/php-irc.git
7 | sudo apt-get install php5-cli
8 | cd php-irc/
9 | nano bot.conf
10 | php bot.php bot.conf
11 | ```
12 |
13 | Thats it shuld be up and running now (tested on debian 7/8).
14 | NOTE: some modules requires php5-curl and if you want to use database make sure to install driver for that php5-mysqlnd etc :)
15 |
16 | ### enable/disable mods
17 | Take a look at function.conf default file used in bot.conf to define what modules are loaded
18 |
19 | ### reload changes in modules without restart
20 | for this you need to set a new adminpass todo that:
21 | * `php bot.php -c NEWPASS`
22 | * this will give you a hash of the pass you can put in bot.conf
23 | * to reload the bot simple msg it, `/msg BOT admin NEWPASS reloadfunc`
24 |
25 |
26 | Happy Modding
27 |
--------------------------------------------------------------------------------
/changes.txt:
--------------------------------------------------------------------------------
1 | +---------------------------------------------------------------------------
2 | | PHP-IRC v2.2.3 Service Release
3 | | ========================================================
4 | | by Manick
5 | | (c) 2001-2005 by http://www.phpbots.org/
6 | | Contact: manick@manekian.com
7 | | irc: #manekian@irc.rizon.net
8 | | ========================================
9 | | Maintained by g2x3k
10 | | 2011-2015 https://github.com/g2x3k/php-irc
11 | | contant: g2x3k@layer13.net
12 | | irc: #root @ irc.layer13.net:+7000
13 | +---------------------------------------------------------------------------
14 | | > remote class module
15 | | > Module written by Manick
16 | | > Module Version Number: 2.2.0
17 | +---------------------------------------------------------------------------
18 | | > This program is free software; you can redistribute it and/or
19 | | > modify it under the terms of the GNU General Public License
20 | | > as published by the Free Software Foundation; either version 2
21 | | > of the License, or (at your option) any later version.
22 | | >
23 | | > This program is distributed in the hope that it will be useful,
24 | | > but WITHOUT ANY WARRANTY; without even the implied warranty of
25 | | > MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26 | | > GNU General Public License for more details.
27 | | >
28 | | > You should have received a copy of the GNU General Public License
29 | | > along with this program; if not, write to the Free Software
30 | | > Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
31 | +---------------------------------------------------------------------------
32 | | Changes
33 | | =======-------
34 | | > If you wish to suggest or submit an update/change to the source
35 | | > code, post a pull request or issue on github and i will into it
36 | | > https://github.com/g2x3k/php-irc
37 | | > maintained by g2x3k
38 | +---------------------------------------------------------------------------
39 |
40 |
41 | + taken over by g2x3k see https://github.com/g2x3k/php-irc/commits/master for changes
42 |
43 | - Added: New website: http://www.phpbots.org/
44 | - Added: "$this->getModule($modName)" for modules, so that they can access other modules directly
45 | - Added: Ability to spawn new bot from admin interface
46 | - Added: Ability to bind to IP when connecting to server
47 | - Added: Ability to connect to passworded servers
48 | - Added: 'raw' module option, where all messages of any type are passed to the module specified
49 | - Added: 'action' module option, to capture the '/me' tag.
50 |
51 | - Changed: Added news module and added "!news del high" and "!news del low" commands
52 | - Changed: Fixed bug in chat.php where "true" was mistyped as "ture" in handshaketimeout function
53 | - Changed: Fixed bug in irc::myStrToLower and irc::myStrToUpper
54 | - Changed: Fixed bug where 004 wasn't be interpreted correctly as 'connect' in function files
55 | - Changed: Fixed bug where bot trys to identify when asked to by nickserv and password field commented out in config file.
56 | - Changed: Fixed Major bug where onRead() was being done before onAccept() was called on a new created listen socket.
57 |
--------------------------------------------------------------------------------
/checkbot.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | # Check if bot is runing then exit otherwise restart
3 | # in crontab
4 | # 0,10,20,30,40,50 * * * * /home/your_bot_folder/checkbot.sh
5 |
6 |
7 | MYPATH=/home/your_bot_folder/
8 |
9 | PID=0
10 |
11 | if test -r $MYPATH/php-irc.pid; then
12 | PID=$(cat $MYPATH/php-irc.pid)
13 | fi
14 |
15 | if [ 0 -ne $PID ]; then
16 | running=`ps --pid $PID | grep $PID |wc -l`
17 |
18 | if [ $running -eq 1 ]; then
19 | exit 1
20 | fi
21 | fi
22 |
23 | cd $MYPATH
24 | ./bot.sh & >/dev/null
--------------------------------------------------------------------------------
/databases/postgre.php:
--------------------------------------------------------------------------------
1 | Database class module
18 | | > Module written by Manick
19 | | > Module Version Number: 2.2.0
20 | +---------------------------------------------------------------------------
21 | | > This program is free software; you can redistribute it and/or
22 | | > modify it under the terms of the GNU General Public License
23 | | > as published by the Free Software Foundation; either version 2
24 | | > of the License, or (at your option) any later version.
25 | | >
26 | | > This program is distributed in the hope that it will be useful,
27 | | > but WITHOUT ANY WARRANTY; without even the implied warranty of
28 | | > MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
29 | | > GNU General Public License for more details.
30 | | >
31 | | > You should have received a copy of the GNU General Public License
32 | | > along with this program; if not, write to the Free Software
33 | | > Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
34 | +---------------------------------------------------------------------------
35 | | Changes
36 | | =======-------
37 | | > If you wish to suggest or submit an update/change to the source
38 | | > code, post a pull request or issue on github and i will into it
39 | | > https://github.com/g2x3k/php-irc
40 | | > maintained by g2x3k
41 | +---------------------------------------------------------------------------
42 | */
43 | class postgre
44 | {
45 |
46 | private $dbIndex;
47 | private $prefix;
48 | private $queries = 0;
49 | private $isConnected = false;
50 | private $error;
51 |
52 | public function __construct($host, $database, $user, $pass, $prefix, $port = 5432)
53 | {
54 | $this->error = true;
55 |
56 | $connect = "host=" . $host . " " .
57 | "port=" . $port . " " .
58 | "dbname=" . $database . " " .
59 | "user=" . $user . " " .
60 | "password=" . $pass;
61 |
62 | $this->error = pg_connect($connect);
63 |
64 | if (!$this->error) {
65 | return;
66 | }
67 |
68 | $this->prefix = $prefix;
69 | $this->dbIndex = $this->error;
70 | $this->isConnected = true;
71 | }
72 |
73 | public function getError()
74 | {
75 | return $this->error === false ? true : false;
76 | //return (@mysql_error($this->dbIndex));
77 | }
78 |
79 | public function isConnected()
80 | {
81 | return $this->isConnected;
82 | }
83 |
84 | private function fixVar($id, $values)
85 | {
86 | return pg_escape_string($values[intval($id) - 1]);
87 | }
88 |
89 | public function query($query, $values = array())
90 | {
91 |
92 | if (!is_array($values))
93 | $values = array($values);
94 |
95 | $query = preg_replace('/\[([0-9]+)]/e', "\$this->fixVar(\\1, &\$values)", $query);
96 |
97 | $this->queries++;
98 |
99 | $data = pg_query($this->dbIndex, $query);
100 |
101 | if (!$data) {
102 | $this->error = $data;
103 | return false;
104 | }
105 |
106 | return $data;
107 | }
108 |
109 |
110 | public function queryFetch($query, $values = array())
111 | {
112 |
113 | if (!is_array($values))
114 | $values = array($values);
115 |
116 | $query = preg_replace('/\[([0-9]+)]/e', "\$this->fixVar(\\1, &\$values)", $query);
117 |
118 | $this->queries++;
119 |
120 | $data = pg_query($query, $this->dbIndex);
121 |
122 | if (!$data) {
123 | $this->error = false;
124 | return false;
125 | }
126 |
127 | return pg_fetch_array($data);
128 | }
129 |
130 |
131 | public function fetchArray($toFetch)
132 | {
133 | return pg_fetch_array($toFetch);
134 | }
135 |
136 | public function fetchRow($toFetch)
137 | {
138 | return pg_fetch_row($toFetch);
139 | }
140 |
141 | public function close()
142 | {
143 | @pg_close($this->dbIndex);
144 | }
145 |
146 | public function lastID()
147 | {
148 | //ehhh. don't use this.
149 | return null;
150 | }
151 |
152 | public function numRows($toFetch)
153 | {
154 | return pg_num_rows($toFetch);
155 | }
156 |
157 | public function numQueries()
158 | {
159 | return $this->queries;
160 | }
161 |
162 | }
163 |
164 | ?>
165 |
166 |
--------------------------------------------------------------------------------
/databases/postgres.php:
--------------------------------------------------------------------------------
1 | Database class module
17 | | > Module written by Manick
18 | | > Module Version Number: 2.2.0
19 | +---------------------------------------------------------------------------
20 | | > This program is free software; you can redistribute it and/or
21 | | > modify it under the terms of the GNU General Public License
22 | | > as published by the Free Software Foundation; either version 2
23 | | > of the License, or (at your option) any later version.
24 | | >
25 | | > This program is distributed in the hope that it will be useful,
26 | | > but WITHOUT ANY WARRANTY; without even the implied warranty of
27 | | > MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
28 | | > GNU General Public License for more details.
29 | | >
30 | | > You should have received a copy of the GNU General Public License
31 | | > along with this program; if not, write to the Free Software
32 | | > Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
33 | +---------------------------------------------------------------------------
34 | | Changes
35 | | =======-------
36 | | > If you wish to suggest or submit an update/change to the source
37 | | > code, post a pull request or issue on github and i will into it
38 | | > https://github.com/g2x3k/php-irc
39 | | > maintained by g2x3k
40 | +---------------------------------------------------------------------------
41 | */
42 |
43 | // *** Modified by Nemesis128_at_atarax_dot_org
44 |
45 | class postgresql
46 | {
47 |
48 | private $dbRes;
49 | private $prefix;
50 | private $numQueries = 0;
51 | private $isConnected = false;
52 | private $error = false;
53 |
54 | private $user;
55 | private $pswd;
56 | private $dbase;
57 | private $host;
58 | private $port;
59 |
60 | public function __construct($user, $pswd, $dbase, $prefix, $host = null, $port = 5432)
61 | {
62 |
63 | $this->user = $user;
64 | $this->pswd = $pswd;
65 | $this->dbase = $dbase;
66 | $this->prefix = $prefix;
67 | $this->host = $host;
68 | $this->port = $port;
69 |
70 | $conn_str = '';
71 |
72 | if (!is_null($host)) { // connect thru TCP/IP
73 | $conn_str .= 'host=' . $host;
74 | $conn_str .= ' port=' . $port;
75 | } // else thru intern sockets
76 | $conn_str .= ' user=' . $user;
77 | $conn_str .= ' password=' . $pswd;
78 | $conn_str .= ' dbname=' . $dbase;
79 |
80 | $this->dbRes = pg_connect($conn_str);
81 |
82 | if (!is_resource($this->dbRes)) {
83 | $this->error = 'PgSQL Connection error';
84 | return;
85 | }
86 |
87 | $this->isConnected = true;
88 | }
89 |
90 | public function getError()
91 | {
92 | if ($this->error) {
93 | $err = $this->error . "\n\n";
94 | return ($err . @pg_last_error($this->dbIndex));
95 | } else {
96 | return null;
97 | }
98 | }
99 |
100 | public function isConnected()
101 | {
102 | return $this->isConnected;
103 | }
104 |
105 | public static function esc($var)
106 | {
107 | return pg_escape_string($var);
108 | }
109 |
110 | public function query($query_str)
111 | {
112 |
113 | if (pg_connection_status($this->dbRes) === PGSQL_CONNECTION_BAD) {
114 | if (!pg_connection_reset($this->dbRes)) {
115 | $this->error = 'Connection lost';
116 | $this->isConnected = false;
117 | return false;
118 | }
119 | }
120 |
121 | $this->numQueries++;
122 |
123 | $res = @pg_query($this->dbRes, $query_str);
124 |
125 | if (!$res) {
126 | $this->error = 'Query failed: ' . pg_last_error() . ' (' . $query_str . ')';
127 | return false;
128 | }
129 |
130 | return $res;
131 | }
132 |
133 | public function fetchArray($toFetch)
134 | {
135 | return pg_fetch_assoc($toFetch);
136 | }
137 |
138 | public function fetchObject($toFetch)
139 | {
140 | return pg_fetch_object($toFetch);
141 | }
142 |
143 | public function fetchRow($toFetch)
144 | {
145 | return pg_fetch_row($toFetch);
146 | }
147 |
148 | public function numRows($toFetch)
149 | {
150 | return pg_num_rows($toFetch);
151 | }
152 |
153 | public function numQueries()
154 | {
155 | return $this->numQueries;
156 | }
157 |
158 | public function close()
159 | {
160 | @pg_close($this->dbRes);
161 | }
162 |
163 | }
164 |
165 | ?>
--------------------------------------------------------------------------------
/error.php:
--------------------------------------------------------------------------------
1 | error class module
18 | | > Module written by Manick
19 | | > Module Version Number: 2.2.0
20 | +---------------------------------------------------------------------------
21 | | > This program is free software; you can redistribute it and/or
22 | | > modify it under the terms of the GNU General Public License
23 | | > as published by the Free Software Foundation; either version 2
24 | | > of the License, or (at your option) any later version.
25 | | >
26 | | > This program is distributed in the hope that it will be useful,
27 | | > but WITHOUT ANY WARRANTY; without even the implied warranty of
28 | | > MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
29 | | > GNU General Public License for more details.
30 | | >
31 | | > You should have received a copy of the GNU General Public License
32 | | > along with this program; if not, write to the Free Software
33 | | > Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
34 | +---------------------------------------------------------------------------
35 | | Changes
36 | | =======-------
37 | | > If you wish to suggest or submit an update/change to the source
38 | | > code, post a pull request or issue on github and i will into it
39 | | > https://github.com/g2x3k/php-irc
40 | | > maintained by g2x3k
41 | +---------------------------------------------------------------------------
42 | */
43 |
44 | class ConnectException extends Exception
45 | {
46 |
47 | private $exceptionTime = 0;
48 |
49 | function __construct($message)
50 | {
51 | parent::__construct($message);
52 | $this->exceptionTime = time();
53 | }
54 |
55 | function getTime()
56 | {
57 | return $this->exceptionTime;
58 | }
59 | }
60 |
61 |
62 | class SendDataException extends Exception
63 | {
64 |
65 | private $exceptionTime = 0;
66 |
67 | function __construct($message)
68 | {
69 | parent::__construct($message);
70 | $this->exceptionTime = time();
71 | }
72 |
73 | function getTime()
74 | {
75 | return $this->exceptionTime;
76 | }
77 | }
78 |
79 |
80 | class ConnectionTimeout extends Exception
81 | {
82 |
83 | private $exceptionTime = 0;
84 |
85 | function __construct($message)
86 | {
87 | parent::__construct($message);
88 | $this->exceptionTime = time();
89 | }
90 |
91 | function getTime()
92 | {
93 | return $this->exceptionTime;
94 | }
95 | }
96 |
97 |
98 | class ReadException extends Exception
99 | {
100 |
101 | private $exceptionTime = 0;
102 |
103 | function __construct($message)
104 | {
105 | parent::__construct($message);
106 | $this->exceptionTime = time();
107 | }
108 |
109 | function getTime()
110 | {
111 | return $this->exceptionTime;
112 | }
113 | }
114 |
115 | ?>
116 |
--------------------------------------------------------------------------------
/function.conf:
--------------------------------------------------------------------------------
1 | ;+---------------------------------------------------------------------------
2 | ;| PHP-IRC v2.2.3 Service Release
3 | ;| ========================================================
4 | ;| by Manick
5 | ;| (c) 2001-2005 by http://www.phpbots.org/
6 | ;| Contact: manick@manekian.com
7 | ;| irc: #manekian@irc.rizon.net
8 | ;| ========================================
9 | ;| Special Contributions were made by:
10 | ;| cortex
11 | ;| ========================================
12 | ;| Maintained by g2x3k
13 | ;| 2011-2015 https://github.com/g2x3k/php-irc
14 | ;| contant: g2x3k@layer13.net
15 | ;| irc: #root @ irc.layer13.net:+7000
16 | ;+---------------------------------------------------------------------------
17 | ;| > function file
18 | ;+---------------------------------------------------------------------------
19 | ;| > This program is free software; you can redistribute it and/or
20 | ;| > modify it under the terms of the GNU General Public License
21 | ;| > as published by the Free Software Foundation; either version 2
22 | ;| > of the License, or (at your option) any later version.
23 | ;| >
24 | ;| > This program is distributed in the hope that it will be useful,
25 | ;| > but WITHOUT ANY WARRANTY; without even the implied warranty of
26 | ;| > MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27 | ;| > GNU General Public License for more details.
28 | ;| >
29 | ;| > You should have received a copy of the GNU General Public License
30 | ;| > along with this program; if not, write to the Free Software
31 | ;| > Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
32 | ;+---------------------------------------------------------------------------
33 | ;| Changes
34 | ;| =======-------
35 | ;| > If you wish to suggest or submit an update/change to the source
36 | ;| > code, post a pull request or issue on github and i will into it
37 | ;| > https://github.com/g2x3k/php-irc
38 | ;| > maintained by g2x3k
39 | ;+---------------------------------------------------------------------------
40 |
41 |
42 | ; some notes:
43 | ; the ~ operater spans definitions over multiple lines. the ; operator
44 | ; denotes a comment. it can be placed anywhere. you must escape
45 | ; your single quotes in quoted entries with a backslash \. the first
46 | ; type of every statement is explained
47 |
48 | ; NOTE: as of 2.2.0, all function configuration was moved to specific files using
49 | ; the 'include' function. General type definitions can be found in typedefs.conf
50 |
51 | include typedefs.conf
52 |
53 | include modules/default/priv_mod.conf
54 | include modules/default/dcc_mod.conf
55 | ;include modules/bad_words/bad_words.conf
56 | include modules/peak_mod/peak_mod.conf
57 | include modules/seen/seen_mod.conf
58 | include modules/news/news_mod.conf
59 | include modules/imdb/imdb_mod.conf
60 | include modules/quotes_ini/quote_mod.conf
61 | ;include modules/quotes_sql/quote_mod.conf
62 | ;include modules/httpd/httpd_mod.conf
63 | ;include modules/fileserver/fileserver.conf
64 | include modules/bash/bash_mod.conf
65 | ;include modules/blackjack/blackjack_mod.conf
66 | include modules/uptime/uptime_mod.conf
67 | include modules/urlreveal/urlreveal.conf
68 | include modules/perform/perform_mod.conf
69 | include modules/joke/joke_mod.conf
70 | include modules/perform/perform_mod.conf
71 | ;include modules/banip/banip_mod.conf
72 | ; socketexample disabled default ..
73 | ;include modules/socketexample/socketexample.conf
74 |
75 |
--------------------------------------------------------------------------------
/install.txt:
--------------------------------------------------------------------------------
1 | Please read readme.txt Section 3 for installation instructions.
2 |
3 | For QUICK INSTALL, please read Section 3-a of installation instructions. You MUST set a variable in defines.php for this bot to work.
--------------------------------------------------------------------------------
/launch.sh:
--------------------------------------------------------------------------------
1 | #! /bin/sh
2 | nohup php -f bot.php layer13.conf >> /dev/null &
3 |
--------------------------------------------------------------------------------
/module.php:
--------------------------------------------------------------------------------
1 | module class
18 | | > Module written by Manick
19 | | > Module Version Number: 2.2.0
20 | +---------------------------------------------------------------------------
21 | | > This program is free software; you can redistribute it and/or
22 | | > modify it under the terms of the GNU General Public License
23 | | > as published by the Free Software Foundation; either version 2
24 | | > of the License, or (at your option) any later version.
25 | | >
26 | | > This program is distributed in the hope that it will be useful,
27 | | > but WITHOUT ANY WARRANTY; without even the implied warranty of
28 | | > MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
29 | | > GNU General Public License for more details.
30 | | >
31 | | > You should have received a copy of the GNU General Public License
32 | | > along with this program; if not, write to the Free Software
33 | | > Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
34 | +---------------------------------------------------------------------------
35 | | Changes
36 | | =======-------
37 | | > If you wish to suggest or submit an update/change to the source
38 | | > code, post a pull request or issue on github and i will into it
39 | | > https://github.com/g2x3k/php-irc
40 | | > maintained by g2x3k
41 | +---------------------------------------------------------------------------
42 | */
43 |
44 | abstract class module
45 | {
46 |
47 | public $title = "
";
48 | public $author = "";
49 | public $version = "";
50 | public $dontShow = false;
51 |
52 | public $ircClass;
53 | public $dccClass;
54 | public $timerClass;
55 | public $parserClass;
56 | public $socketClass;
57 | public $db;
58 |
59 | public function __construct()
60 | {
61 | //Nothing here...
62 | }
63 |
64 | public function __destruct()
65 | {
66 | $this->ircClass = null;
67 | $this->dccClass = null;
68 | $this->timerClass = null;
69 | $this->parserClass = null;
70 | $this->socketClass = null;
71 | $this->db = null;
72 | //Nothing here
73 | }
74 |
75 | public final function __setClasses($ircClass, $dccClass, $timerClass, $parserClass,
76 | $socketClass, $db)
77 | {
78 | $this->ircClass = $ircClass;
79 | $this->dccClass = $dccClass;
80 | $this->timerClass = $timerClass;
81 | $this->parserClass = $parserClass;
82 | $this->socketClass = $socketClass;
83 | $this->db = $db;
84 | }
85 |
86 | public final function getModule($modName)
87 | {
88 | $mods = $this->parserClass->getCmdList("file");
89 |
90 | if ($mods === false) {
91 | return false;
92 | }
93 |
94 | if (isset($mods[$modName])) {
95 | return $mods[$modName]['class'];
96 | }
97 |
98 | return false;
99 | }
100 |
101 | public function handle($chat, $args)
102 | {
103 | }
104 |
105 | public function connected($chat)
106 | {
107 | }
108 |
109 | public function main($line, $args)
110 | {
111 | $port = $this->dccClass->addChat($line['fromNick'], null, null, false, $this);
112 |
113 | if ($port === false) {
114 | $this->ircClass->notice($line['fromNick'], "Error starting chat, please try again.", 1);
115 | }
116 | }
117 |
118 | public function init()
119 | {
120 | //Global.. this needs to be overwritten
121 | }
122 |
123 | public function destroy()
124 | {
125 | //Global.. this needs to be overwritten
126 | }
127 |
128 | }
129 |
130 | ?>
131 |
--------------------------------------------------------------------------------
/modules/bad_words/bad_words.conf:
--------------------------------------------------------------------------------
1 | file bad_words_mod modules/bad_words/bad_words_mod.php
2 |
3 | notice bad_words_mod bad_words
4 | privmsg bad_words_mod bad_words
5 |
6 | priv !reload true true true 0 bad_words_mod reload
--------------------------------------------------------------------------------
/modules/bad_words/bad_words.ini:
--------------------------------------------------------------------------------
1 | [#manekian]
2 | fuck
3 | fuck(.+?)
4 | ass
5 |
--------------------------------------------------------------------------------
/modules/bad_words/bad_words_mod.php:
--------------------------------------------------------------------------------
1 | badWords);
16 | $this->badWords = array();
17 |
18 | $badWords = new ini("modules/bad_words/bad_words.ini");
19 |
20 | if ($badWords->getError()) {
21 | return;
22 | }
23 |
24 | $channels = $badWords->getSections();
25 |
26 | if ($channels === false) {
27 | return;
28 | }
29 |
30 | foreach ($channels AS $channel) {
31 | $channel = irc::myStrToLower($channel);
32 |
33 | $bw = $badWords->getSection($channel);
34 |
35 | if ($bw == false || !is_array($bw)) {
36 | continue;
37 | }
38 |
39 | foreach ($bw AS $badword => $blah) {
40 | $this->badWords[$channel][$badword] = true;
41 | }
42 | }
43 | }
44 |
45 |
46 | public function reload($line, $args)
47 | {
48 | if (!$this->ircClass->hasModeSet($line['to'], $line['fromNick'], "oa")) {
49 | return;
50 | }
51 |
52 | $this->init();
53 | $this->ircClass->notice($line['fromNick'], "Reload command sent.");
54 | }
55 |
56 | public function bad_words($line, $args)
57 | {
58 | if ($line['to'] == $this->ircClass->getNick()) {
59 | return;
60 | }
61 |
62 | $chan = irc::myStrToLower($line['to']);
63 |
64 | if (!$this->ircClass->hasModeSet($line['to'], $this->ircClass->getNick(), "hoa")) {
65 | return; // we don't have power to kick!
66 | }
67 |
68 | if (isset($this->badWords[$chan])) {
69 | foreach ($this->badWords[$chan] AS $bw => $blah) {
70 | if (preg_match("/ " . $bw . " /i", " " . $line['text'] . " ")) {
71 | $this->ircClass->sendRaw("KICK " . $line['to'] . " " . $line['fromNick'] . " :Bad word!");
72 | break;
73 | }
74 | }
75 | }
76 | }
77 | }
78 |
79 | ?>
80 |
--------------------------------------------------------------------------------
/modules/banip/banip_mod.conf:
--------------------------------------------------------------------------------
1 | file banip_mod modules/banip/banip_mod.php
2 |
3 | priv !banip true false true 0 banip_mod priv_banip
4 | priv !unbanip true false true 0 banip_mod priv_unbanip
5 |
--------------------------------------------------------------------------------
/modules/banip/banip_mod.php:
--------------------------------------------------------------------------------
1 | bancfg["allowfrom"] = array("g2x3k", "bette");
14 | // where to ban ?
15 | $this->bancfg["cloudflare"] = true;
16 | $this->bancfg["ircdgline"] = true;
17 | $this->bancfg["iptables"] = true;
18 | }
19 |
20 | public function priv_banip($line, $args)
21 | {
22 |
23 | $channel = $line['to'];
24 | $text = explode(" ", $line["text"]);
25 | $nick = $line['fromNick'];
26 | $ip = $text[1];
27 | $reason = $text[2];
28 |
29 | if (strpos($channel, "#") === false)
30 | return;
31 |
32 | if (!in_array($nick, $this->bancfg["allowfrom"]))
33 | return;
34 |
35 | if (!filter_var($ip, FILTER_VALIDATE_IP)) {
36 | $this->ircClass->privMsg("$channel", "Provide a valid ip .. ($ip) is not valid");
37 | return;
38 | }
39 |
40 | if (strlen($reason) < 1) {
41 | $this->ircClass->privMsg("$channel", "No reason provided... !banip (IP) [reason], setting to no.reason");
42 | $reason = "No.Reason";
43 | }
44 |
45 | //Cloudflare
46 | if ($this->bancfg["cloudflare"])
47 | exec("curl https://www.cloudflare.com/api_json.html -d 'a=ban' -d 'tkn=" . $this->clapikey . "' -d 'email=faceydk@gmail.com' -d 'key=$ip' -d 'reason=$reason' ");
48 |
49 | // iRCD / GLiNE
50 | if ($this->bancfg["ircdgline"]) {
51 | $hostname = gethostbyaddr($ip);
52 | $this->ircClass->sendRaw("gline *@$ip 365d $reason");
53 | if ($ip != $host) {
54 | $this->ircClass->sendRaw("gline *@$hostname 365d $reason");
55 | }
56 | }
57 | // iptables - requires my iptables mysql addon, https://gist.github.com/g2x3k/58aa48c6c710052d9f85
58 | if ($this->bancfg["iptables"])
59 | $this->db->query("INSERT INTO `ipbans` (`id`, `ip`, `reason`) VALUES (NULL, '$ip', '$reason');");
60 |
61 |
62 | $this->ircClass->privMsg("$channel", "Banned $ip " . ($ip != $hostname ? "($hostname)" : ""));
63 | }
64 |
65 | public function priv_unbanip($line, $args)
66 | {
67 | $exectimer = xtimer(); // started timer
68 | $channel = $line['to'];
69 | $text = explode(" ", $line["text"]);
70 | $nick = $line['fromNick'];
71 | $ip = $text[1];
72 |
73 |
74 | if (strpos($channel, "#") === false)
75 | return;
76 |
77 | if (!in_array($nick, $this->bancfg["allowfrom"]))
78 | return;
79 |
80 | if (!filter_var($ip, FILTER_VALIDATE_IP)) {
81 | $this->ircClass->privMsg("$channel", "Provide a valid ip .. ($ip) is not valid");
82 | return;
83 | }
84 |
85 |
86 | //Cloudflare
87 | if ($this->bancfg["cloudflare"])
88 | exec("curl https://www.cloudflare.com/api_json.html -d 'a=nul' -d 'tkn=" . $this->clapikey . "' -d 'email=faceydk@gmail.com' -d 'key=$ip' -d 'reason=$reason' ");
89 |
90 | // iRCD / GLiNE
91 | if ($this->bancfg["ircdgline"]) {
92 | $hostname = gethostbyaddr($ip);
93 | $this->ircClass->sendRaw("gline -*@$ip 365d $reason");
94 | if ($ip != $host)
95 | $this->ircClass->sendRaw("gline -*@$hostname 365d $reason");
96 | }
97 | // iptables
98 | if ($this->bancfg["iptables"])
99 | $this->db->query("DELETE FROM `ipbans` WHERE `ipbans`.`ip` LIKE '$ip';");
100 |
101 |
102 | $this->ircClass->privMsg("$channel", "Unbanned $ip " . ($ip != $hostname ? "($hostname)" : ""));
103 | }
104 | }
105 |
106 |
107 | ?>
--------------------------------------------------------------------------------
/modules/bash/bash_mod.conf:
--------------------------------------------------------------------------------
1 | file bash_mod modules/bash/bash_mod.php
2 |
3 | priv !bash true true true 0 bash_mod priv_bash
--------------------------------------------------------------------------------
/modules/blackjack/blackjack_mod.conf:
--------------------------------------------------------------------------------
1 | file blackjack_mod modules/blackjack/blackjack_mod.php
2 |
3 | priv !resetdeck true true true 0 blackjack_mod priv_resetdeck
4 | priv !drawran true true true 0 blackjack_mod priv_drawran
5 | priv !deal true true true 0 blackjack_mod priv_deal
6 | priv !hit true true true 0 blackjack_mod priv_hit
7 | priv !stand true true true 0 blackjack_mod priv_stand
8 | priv !deposit true true true 0 blackjack_mod priv_desposit
9 | priv !withdraw true true true 0 blackjack_mod priv_withdraw
10 |
11 | priv .resetdeck true true true 0 blackjack_mod priv_resetdeck
12 | priv .drawran true true true 0 blackjack_mod priv_drawran
13 | priv .deal true true true 0 blackjack_mod priv_deal
14 | priv .hit true true true 0 blackjack_mod priv_hit
15 | priv .stand true true true 0 blackjack_mod priv_stand
16 | priv .deposit true true true 0 blackjack_mod priv_desposit
17 | priv .withdraw true true true 0 blackjack_mod priv_withdraw
--------------------------------------------------------------------------------
/modules/default/ads.ini:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/g2x3k/php-irc/06bacec6fd2f418f55ca8c61bda267928fe843ee/modules/default/ads.ini
--------------------------------------------------------------------------------
/modules/default/priv_mod.conf:
--------------------------------------------------------------------------------
1 | ;+---------------------------------------------------------------------------
2 | ;| PHP-IRC Internal PRIVMSG Function Configuration File
3 | ;| ========================================================
4 | ;| by Manick
5 | ;| (c) 2001-2004 by http://phpbots.sf.net
6 | ;| Contact: manick@manekian.com
7 | ;| irc: #manekian@irc.rizon.net
8 | ;| ========================================
9 | ;+---------------------------------------------------------------------------
10 | ;| > This program is free software; you can redistribute it and/or
11 | ;| > modify it under the terms of the GNU General Public License
12 | ;| > as published by the Free Software Foundation; either version 2
13 | ;| > of the License, or (at your option) any later version.
14 | ;| >
15 | ;| > This program is distributed in the hope that it will be useful,
16 | ;| > but WITHOUT ANY WARRANTY; without even the implied warranty of
17 | ;| > MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 | ;| > GNU General Public License for more details.
19 | ;| >
20 | ;| > You should have received a copy of the GNU General Public License
21 | ;| > along with this program; if not, write to the Free Software
22 | ;| > Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
23 | ;+---------------------------------------------------------------------------
24 |
25 | file priv_mod modules/default/priv_mod.php
26 |
27 | priv admin ~; text typed in the channel/pm (admin)
28 | true ~; active command on statup?
29 | false ~; inform admins in dcc chat iface if this command is used
30 | false ~; can be deactivated with 'function' dcc command
31 | 0 ~; times used.. just leave this 0 (its for stats).
32 | priv_mod ~; class name (see file import section above)
33 | priv_admin ; function name
34 |
35 | priv !ad true true true 0 priv_mod priv_ad
--------------------------------------------------------------------------------
/modules/fileserver/extra.php:
--------------------------------------------------------------------------------
1 |
18 |
--------------------------------------------------------------------------------
/modules/fileserver/fileserver.conf:
--------------------------------------------------------------------------------
1 | ;+---------------------------------------------------------------------------
2 | ;| PHP-IRC Demo Fileserver Module
3 | ;| ========================================================
4 | ;| by Manick
5 | ;| (c) 2001-2004 by http://phpbots.sf.net
6 | ;| Contact: manick@manekian.com
7 | ;| irc: #manekian@irc.rizon.net
8 | ;| ========================================
9 | ;+---------------------------------------------------------------------------
10 | ;| > This program is free software; you can redistribute it and/or
11 | ;| > modify it under the terms of the GNU General Public License
12 | ;| > as published by the Free Software Foundation; either version 2
13 | ;| > of the License, or (at your option) any later version.
14 | ;| >
15 | ;| > This program is distributed in the hope that it will be useful,
16 | ;| > but WITHOUT ANY WARRANTY; without even the implied warranty of
17 | ;| > MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 | ;| > GNU General Public License for more details.
19 | ;| >
20 | ;| > You should have received a copy of the GNU General Public License
21 | ;| > along with this program; if not, write to the Free Software
22 | ;| > Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
23 | ;+---------------------------------------------------------------------------
24 |
25 | ;Include module
26 | file fileserver modules/fileserver/fileserver.php
27 |
28 | ;Main /ctcp php-irc files call
29 | ctcp files fileserver main
--------------------------------------------------------------------------------
/modules/github/github_mod.conf:
--------------------------------------------------------------------------------
1 | file github_mod modules/github/github_mod.php
2 |
3 |
4 | priv !issue true false true 0 github_mod priv_showIssue
--------------------------------------------------------------------------------
/modules/github/github_mod.php:
--------------------------------------------------------------------------------
1 | ghcfg["repo"] = "g2x3k/php-irc";
27 | }
28 |
29 | public function priv_showIssue($line, $args)
30 | {
31 | $channel = strtolower($line['to']);
32 | $nick = $line['fromNick'];
33 | // !issue [issue_num] [repo]
34 | $issuenum = ($args["nargs"] > 0 ? $args['arg1'] : null);
35 | $repo = ($args["nargs"] > 1 ? $args['arg2'] : $this->ghcfg["repo"]);
36 |
37 | if ($issuenum) {
38 | // list issue
39 | $url = 'https://api.github.com/repos/' . str_replace('%2F', '/', urlencode($repo)) . '/issues/' . $issuenum;
40 |
41 | $data = get_url_contents($url);
42 | $data = json_decode($data["html"]);
43 |
44 | if (empty($data)) {
45 | //$this->bot->say('Fetching issue failed');
46 | $this->ircClass->privMsg($channel, "Fetching failed, tried getting issue $issuenum from $repo");
47 | return;
48 | }
49 |
50 | $this->ircClass->privMsg($channel, (isset($data->pull_request) ? 'Pull request' : 'Issue') . ' #' . $data->number . ': ' . $data->title . ' (' . $data->comments . ' comment(s))');
51 | $this->ircClass->privMsg($channel, 'Reported by ' . $data->user->login . ', current status: ' . $data->state);
52 | $this->ircClass->privMsg($channel, substr(preg_replace('/\s\s+/', ' ', $data->body), 0, 250));
53 | $this->ircClass->privMsg($channel, 'More information: ' . $data->html_url);
54 |
55 | } else {
56 |
57 | $url = 'https://api.github.com/repos/' . str_replace('%2F', '/', urlencode($repo)) . '/issues';
58 |
59 | $data = get_url_contents($url);
60 | $result = json_decode($data["html"]);
61 |
62 | $i = 0;
63 | if (count($result)) {
64 | $this->ircClass->privMsg($channel, "Sending last few issues for $repo in privmsg");
65 |
66 | foreach ($result as $issue) {
67 | if ($i >= 5)
68 | break;
69 |
70 | $this->ircClass->privMsg($nick, (isset($issue->pull_request) ? '[Pull]' : '[Issue]') . ' #' . $issue->number . ': ' . $issue->title . ' (reported by ' . $issue->user->login . ', status: ' . $issue->state . ') <' . $issue->html_url . '>');
71 |
72 | $i++;
73 | }
74 | }
75 | else
76 | $this->ircClass->privMsg($channel, "no issues to display for $repo");
77 | }
78 | }
79 | }
80 |
81 | ?>
--------------------------------------------------------------------------------
/modules/httpd/htdocs/index.html:
--------------------------------------------------------------------------------
1 |
3 |
4 |
5 | PHP-IRC: Modular IRC Bot
6 |
7 |
8 |
9 |
PHP-IRC(this is running on php-irc http server)
10 |
11 |
Introduction
12 |
13 |
14 | PHP-IRC is a modular IRC bot written in PHP5 with a combination of
15 | object based/oriented programming. It operates under several different platforms
16 | with the purpose of automating common information related tasks on IRC.
17 | There are two main reasons that PHP was
18 | selected as the primary language. First off, I wanted to provide novice
19 | programmers a way to code their own functions and abilities into a powerful
20 | platform without having to worry about such things as memory management
21 | and compilers. Secondly, I wanted to do something that no one has done
22 | before--create a fully featured bot in php. I don't know if I will ever
23 | complete the second objective, but I will keep on developing, as it will
24 | always be the main goal of this project. Nevermind the fact that I get
25 | constantly ridiculed by all my friends for doing this... hehe :)
26 |
27 | Current Major Features
28 |
29 |
30 |
31 |
DCC Chat Support with custom DCC Chat handlers via user-defined modules
32 |
DCC File transfer support with NAT and mIRC DCC Reverse protocol support
33 |
Modular based function support
34 |
Event based, with user-definable event handling in a simple to use configuration file
35 |
Multiple bots under one process
36 |
Remote administration via DCC Chat interface or private message
37 |
MySQL support, and a custom *.ini engine for users with no access to database
38 |
Fully documented features and command reference, including in-depth PHP5 installation instructions
39 |
Just to name a few, and more is in the works!
40 |
41 |
42 |
Download
43 |
44 |
45 | PHP-IRC is currently available on sourceforge, here.
46 |
58 |
59 |
60 |
--------------------------------------------------------------------------------
/modules/httpd/http.ini:
--------------------------------------------------------------------------------
1 | [config]
2 | port = 5050
3 | root = modules/httpd/htdocs
4 | defaultindex = index.html
5 | [mime-types]
6 | htm = text/html
7 | html = text/html
8 | jpg = image/jpeg
9 | css = text/html
10 | php = text/html
11 | [handler]
12 | php = "C:\Program Files\Apache Group\PHP\php-cgi.exe"
--------------------------------------------------------------------------------
/modules/httpd/httpd_mod.conf:
--------------------------------------------------------------------------------
1 | ;+---------------------------------------------------------------------------
2 | ;| PHP-IRC Demo Mini Http Server
3 | ;| ========================================================
4 | ;| by Manick
5 | ;| (c) 2001-2004 by http://phpbots.sf.net
6 | ;| Contact: manick@manekian.com
7 | ;| irc: #manekian@irc.rizon.net
8 | ;| ========================================
9 | ;+---------------------------------------------------------------------------
10 | ;| > This program is free software; you can redistribute it and/or
11 | ;| > modify it under the terms of the GNU General Public License
12 | ;| > as published by the Free Software Foundation; either version 2
13 | ;| > of the License, or (at your option) any later version.
14 | ;| >
15 | ;| > This program is distributed in the hope that it will be useful,
16 | ;| > but WITHOUT ANY WARRANTY; without even the implied warranty of
17 | ;| > MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 | ;| > GNU General Public License for more details.
19 | ;| >
20 | ;| > You should have received a copy of the GNU General Public License
21 | ;| > along with this program; if not, write to the Free Software
22 | ;| > Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
23 | ;+---------------------------------------------------------------------------
24 |
25 | ;startup httpd server
26 | file httpd_mod modules/httpd/httpd_mod.php
--------------------------------------------------------------------------------
/modules/imdb/imdb_mod.conf:
--------------------------------------------------------------------------------
1 | ;+---------------------------------------------------------------------------
2 | ;| PHP-IRC IMDB Parsing Mod
3 | ;| ========================================================
4 | ;| by Manick
5 | ;| (c) 2001-2004 by http://phpbots.sf.net
6 | ;| Contact: manick@manekian.com
7 | ;| irc: #manekian@irc.rizon.net
8 | ;| ========================================
9 | ;+---------------------------------------------------------------------------
10 | ;| > This program is free software; you can redistribute it and/or
11 | ;| > modify it under the terms of the GNU General Public License
12 | ;| > as published by the Free Software Foundation; either version 2
13 | ;| > of the License, or (at your option) any later version.
14 | ;| >
15 | ;| > This program is distributed in the hope that it will be useful,
16 | ;| > but WITHOUT ANY WARRANTY; without even the implied warranty of
17 | ;| > MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 | ;| > GNU General Public License for more details.
19 | ;| >
20 | ;| > You should have received a copy of the GNU General Public License
21 | ;| > along with this program; if not, write to the Free Software
22 | ;| > Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
23 | ;+---------------------------------------------------------------------------
24 |
25 | file imdb_mod modules/imdb/imdb_mod.php
26 | priv !imdb true true true 0 imdb_mod parse_imdb
--------------------------------------------------------------------------------
/modules/joke/joke_mod.conf:
--------------------------------------------------------------------------------
1 | file joke_mod modules/joke/joke_mod.php
2 |
3 | priv !joke true true true 0 joke_mod priv_joke
--------------------------------------------------------------------------------
/modules/joke/joke_mod.php:
--------------------------------------------------------------------------------
1 | value->joke)) {
27 | $this->ircClass->privMsg($channel, html_entity_decode($joke->value->joke));
28 | }
29 | }
30 | else
31 | $this->ircClass->privMsg($channel, "I don't feel like laughing today. :(");
32 |
33 | }
34 | }
35 |
36 | ?>
--------------------------------------------------------------------------------
/modules/more_mods.txt:
--------------------------------------------------------------------------------
1 | For More Modules, see the website: http://www.phpbots.org
--------------------------------------------------------------------------------
/modules/news/news_mod.conf:
--------------------------------------------------------------------------------
1 | file news_mod modules/news/news_mod.php
2 |
3 | priv !news true true true 0 news_mod priv_news
4 |
5 | ;You can add more triggers to the same function, and they will have a unique
6 | ;database.. for example, with the !requests function below.
7 | ;priv !requests true true true 0 news_mod priv_news
8 |
--------------------------------------------------------------------------------
/modules/peak_mod/peak_mod.conf:
--------------------------------------------------------------------------------
1 | file peak_mod modules/peak_mod/peak_mod.php
2 |
3 | join peak_mod peak_on_join
4 | priv !peak true true true 0 peak_mod priv_peak
--------------------------------------------------------------------------------
/modules/peak_mod/peak_mod.php:
--------------------------------------------------------------------------------
1 | peak = new ini("modules/peak_mod/peak.ini");
28 | }
29 |
30 | public function peak_on_join($line, $args) {
31 | if ($this->peak->getError())
32 | return;
33 |
34 |
35 | $chan = strtolower($line['text']);
36 | $chanData = $this->ircClass->getChannelData($chan);
37 |
38 | if (!is_object($chanData))
39 | return;
40 |
41 | $peak = $this->peak->getIniVal($chan, "peak");
42 | if ($peak === false || $peak < $chanData->count) {
43 |
44 |
45 | $this->peak->setIniVal($chan, "peak", $chanData->count);
46 | $this->peak->setIniVal($chan, "time", time());
47 | $this->peak->writeIni();
48 |
49 | // only allow peak announces in root, uncomment next two lines to allow everywhere channel bot is in
50 | if ($chan != "#root")
51 | return;
52 |
53 | $this->ircClass->privMsg($chan, "New PEAK for $chan: ".$chanData->count." ");
54 | }
55 | }
56 | public function priv_peak($line, $args) {
57 | if ($line['to'] === $this->ircClass->getNick()) {
58 | return;
59 | }
60 |
61 | if ($this->peak->getError()) {
62 | $this->ircClass->notice($line['fromNick'], "Unexplained error opening peak database.");
63 | return;
64 | }
65 |
66 | if ($args['nargs'] <= 0)
67 | $chan = strtolower($line['to']);
68 | else
69 | $chan = strtolower($args['arg1']);
70 |
71 | $chanData = $this->peak->getSection($chan);
72 | if ($chanData == false) {
73 | $this->ircClass->notice($line['fromNick'], "I have no data for that channel.");
74 | return;
75 | }
76 |
77 | $time = date("l, F jS, Y @ G:i", $chanData['time']);
78 | $this->ircClass->privMsg($line['to'], "PEAK:, " . $line['fromNick'] . ", the current peak for $chan is " . BOLD .
79 | $chanData['peak'] . BOLD . " users on " . BOLD . $time . BOLD . ".");
80 | }
81 | }
82 | ?>
--------------------------------------------------------------------------------
/modules/perform/perform_mod.conf:
--------------------------------------------------------------------------------
1 | file perform_mod modules/perform/perform_mod.php
2 |
3 | connect perform_mod onConnect
4 | join perform_mod onJoin
5 |
6 |
--------------------------------------------------------------------------------
/modules/perform/perform_mod.php:
--------------------------------------------------------------------------------
1 | ircClass->joinChannel("#vhost"); // join the vhost channel
25 | $this->ircClass->privMsg("g2x3k", "Iam back!"); // msg nickserver register/identify ?
26 | }
27 |
28 | public function onJoin($line)
29 | {
30 | // simple example of a onJoin mod
31 | $nick = $line['fromNick'];
32 | $channel = $line['text'];
33 | $me = $this->ircClass->getNick();
34 |
35 | if ($this->ircClass->IRCOP)
36 | $mode = "SAMODE";
37 | else
38 | $mode = "MODE";
39 |
40 | // when joing #vhost set a vhost and part the channel
41 | if ($nick == $me AND $channel == "#vhost") {
42 | $this->ircClass->privMsg($channel, "!vhost Layer13.net");
43 | $this->ircClass->partChannel($channel); // bye bye vhost
44 |
45 | }
46 | // make bot give itself +a upon entering a channel
47 | elseif ($nick == $me) {
48 | $this->ircClass->sendRaw("$mode $channel +a $me ", true);
49 | }
50 | // a welcome text ?
51 | else {
52 |
53 | }
54 |
55 | }
56 | }
57 | ?>
--------------------------------------------------------------------------------
/modules/quotes_ini/quote_mod.conf:
--------------------------------------------------------------------------------
1 | ;+---------------------------------------------------------------------------
2 | ;| PHP-IRC Quotes Mod without MySQL
3 | ;| ========================================================
4 | ;| by Manick
5 | ;| (c) 2001-2004 by http://phpbots.sf.net
6 | ;| Contact: manick@manekian.com
7 | ;| irc: #manekian@irc.rizon.net
8 | ;| ========================================
9 | ;+---------------------------------------------------------------------------
10 | ;| > This program is free software; you can redistribute it and/or
11 | ;| > modify it under the terms of the GNU General Public License
12 | ;| > as published by the Free Software Foundation; either version 2
13 | ;| > of the License, or (at your option) any later version.
14 | ;| >
15 | ;| > This program is distributed in the hope that it will be useful,
16 | ;| > but WITHOUT ANY WARRANTY; without even the implied warranty of
17 | ;| > MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 | ;| > GNU General Public License for more details.
19 | ;| >
20 | ;| > You should have received a copy of the GNU General Public License
21 | ;| > along with this program; if not, write to the Free Software
22 | ;| > Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
23 | ;+---------------------------------------------------------------------------
24 |
25 | file quotes_mod modules/quotes_ini/quotes_mod.php
26 |
27 | ;Quotes mod 0.1 by Manick, using text file ini-based database
28 | priv !findquote true true true 0 quotes_mod priv_findquote
29 | priv !findauthor true true true 0 quotes_mod priv_findquote
30 | priv !lastquote true true true 0 quotes_mod priv_lastquote
31 | priv !delquote true true true 0 quotes_mod priv_delquote
32 | priv !addquote true true true 0 quotes_mod priv_addquote
33 | priv !quote true true true 0 quotes_mod priv_quote
34 |
--------------------------------------------------------------------------------
/modules/quotes_sql/quote_mod.conf:
--------------------------------------------------------------------------------
1 | ;+---------------------------------------------------------------------------
2 | ;| PHP-IRC Quotes Mod WITH MySQL
3 | ;| ========================================================
4 | ;| by Manick
5 | ;| (c) 2001-2004 by http://phpbots.sf.net
6 | ;| Contact: manick@manekian.com
7 | ;| irc: #manekian@irc.rizon.net
8 | ;| ========================================
9 | ;+---------------------------------------------------------------------------
10 | ;| > This program is free software; you can redistribute it and/or
11 | ;| > modify it under the terms of the GNU General Public License
12 | ;| > as published by the Free Software Foundation; either version 2
13 | ;| > of the License, or (at your option) any later version.
14 | ;| >
15 | ;| > This program is distributed in the hope that it will be useful,
16 | ;| > but WITHOUT ANY WARRANTY; without even the implied warranty of
17 | ;| > MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 | ;| > GNU General Public License for more details.
19 | ;| >
20 | ;| > You should have received a copy of the GNU General Public License
21 | ;| > along with this program; if not, write to the Free Software
22 | ;| > Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
23 | ;+---------------------------------------------------------------------------
24 |
25 | file quotes_mod modules/quotes_sql/quotes_mod.php
26 |
27 | ;Quotes mod 0.1 by Manick, using text file ini-based database
28 | priv !findquote true true true 0 quotes_mod priv_findquote
29 | priv !findauthor true true true 0 quotes_mod priv_findquote
30 | priv !lastquote true true true 0 quotes_mod priv_lastquote
31 | priv !delquote true true true 0 quotes_mod priv_delquote
32 | priv !addquote true true true 0 quotes_mod priv_addquote
33 | priv !quote true true true 0 quotes_mod priv_quote
34 | priv !undelete true true true 0 quotes_mod priv_undelete
35 | dcc delquote 2 "" "Deletes quote from database" true quotes_mod dcc_delquote
36 |
--------------------------------------------------------------------------------
/modules/seen/seen_mod.conf:
--------------------------------------------------------------------------------
1 |
2 | file seen_mod modules/seen/seen_mod.php
3 |
4 | privmsg seen_mod seen
5 | ;notice seen_mod seen
6 | join seen_mod seen
7 | kick seen_mod seen
8 | part seen_mod seen
9 | quit seen_mod seen
10 |
11 | priv !seen true true true 0 seen_mod priv_seen
--------------------------------------------------------------------------------
/modules/serve/serve_mod.conf:
--------------------------------------------------------------------------------
1 | file serve_mod modules/serve/serve_mod.php
2 |
3 | privmsg serve_mod priv_serve
--------------------------------------------------------------------------------
/modules/serve/shcema.sql:
--------------------------------------------------------------------------------
1 | --
2 | -- Table structure for table `servestats`
3 | --
4 |
5 | CREATE TABLE IF NOT EXISTS `servestats` (
6 | `id` int(11) NOT NULL AUTO_INCREMENT,
7 | `nick` varchar(32) CHARACTER SET latin1 NOT NULL,
8 | `address` varchar(255) CHARACTER SET latin1 NOT NULL,
9 | `type` varchar(255) CHARACTER SET latin1 NOT NULL,
10 | `last` decimal(11,0) NOT NULL,
11 | `today` int(11) NOT NULL,
12 | `total` int(11) NOT NULL,
13 | `channel` varchar(255) CHARACTER SET latin1 NOT NULL,
14 | `network` varchar(255) CHARACTER SET latin1 NOT NULL,
15 | PRIMARY KEY (`id`)
16 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
17 |
--------------------------------------------------------------------------------
/modules/socketexample/socketexample.conf:
--------------------------------------------------------------------------------
1 | file socketexample_mod modules/socketexample/socketexample.php
--------------------------------------------------------------------------------
/modules/socketexample/socketexample.php:
--------------------------------------------------------------------------------
1 | error = false;
16 | $this->port = 3666;
17 | $this->annpass = "somepassword";
18 | // socket init
19 | $conn = new connection(null, $this->port, 0);
20 | $conn->setSocketClass($this->socketClass);
21 | $conn->setIrcClass($this->ircClass);
22 | $conn->setCallbackClass($this);
23 | $conn->setTimerClass($this->timerClass);
24 | $conn->setTransTimeout(5);
25 |
26 | $conn->init();
27 |
28 | if ($conn->getError()) {
29 | $this->error == true;
30 | return;
31 | }
32 |
33 | $this->siteListener = $conn;
34 | .
35 | }
36 |
37 | // socket listen
38 | public function onRead($conn)
39 | {
40 | $connInt = $conn->getSockInt();
41 | $q = $this->socketClass->getQueueLine($connInt);
42 | echo " 1 Reading Data: $q \r\n";
43 | $request = explode(" ", $q);
44 | // new incomming syntax: pass action target content
45 | // pass: annpass
46 | // action: msg/raw
47 | // target: #channel/nick or null
48 | $annpass = trim($request[0]);
49 | $action = trim($request[1]);
50 | $target = trim($request[2]);
51 | $content = trim(str_replace(array($annpass, $action, $target), "", $q));
52 |
53 | if ($annpass == $this->annpass) {
54 | if ($action == "msg")
55 | $this->ircClass->privMsg($target, "$content");
56 | elseif ($action == "raw")
57 | $this->ircClass->sendRaw($content);
58 | }
59 |
60 | }
61 |
62 | public function onAccept($oldConn, $newConn)
63 | {
64 | /* dummy */
65 | $this->onConnect($newConn);
66 | }
67 |
68 | public function onConnect($conn)
69 | {
70 | /* dummy */
71 | }
72 |
73 | public function onDead($conn)
74 | {
75 | $conn->disconnect();
76 | }
77 |
78 | public function onTransferTimeout($conn)
79 | {
80 | /* dummy */
81 | }
82 |
83 | }
--------------------------------------------------------------------------------
/modules/template.txt:
--------------------------------------------------------------------------------
1 | ";
21 | public $author = "";
22 | public $version = "";
23 |
24 | public function init()
25 | {
26 | // Add your timer declarations and whatever
27 | // else here...
28 | }
29 |
30 | public function destroy()
31 | {
32 | // Put code here to destroy the timers that you created in init()
33 | // and whatever else cleanup code you want.
34 | }
35 |
36 | //Methods here:
37 | }
38 |
39 | ?>
--------------------------------------------------------------------------------
/modules/uptime/uptime_mod.conf:
--------------------------------------------------------------------------------
1 | file uptime_mod modules/uptime/uptime_mod.php
2 |
3 | priv !uptime true false true 0 uptime_mod priv_uptime
--------------------------------------------------------------------------------
/modules/uptime/uptime_mod.php:
--------------------------------------------------------------------------------
1 | ircClass->getStatusRaw() != STATUS_CONNECTED_REGISTERED)
27 | return;
28 |
29 | $this->ircClass->privMsg($channel, "PHP-IRC v" . VERSION . " [" . VERSION_DATE .
30 | "] by Manick, maintained by g2x3k (visit https://github.com/g2x3k/php-irc to download)");
31 | $this->ircClass->privMsg($channel, "total running time of " . $this->ircClass->
32 | timeFormat($this->ircClass->getRunTime(),
33 | "%d days, %h hours, %m minutes, and %s seconds."));
34 |
35 |
36 | //$chat->dccSend("PHP-IRC v" . VERSION . " [".VERSION_DATE."] by Manick (visit http://phpbots.sf.net/ to download)");
37 | //$chat->dccSend("total running time of " . $this->ircClass->timeFormat($this->ircClass->getRunTime(), "%d days, %h hours, %m minutes, and %s seconds."));
38 |
39 | $fd = @fopen("/proc/" . $this->ircClass->pid() . "/stat", "r");
40 | if ($fd !== false) {
41 | $stat = fread($fd, 1024);
42 | fclose($fd);
43 |
44 | $stat_array = explode(" ", $stat);
45 |
46 | $pid = $stat_array[0];
47 | $comm = $stat_array[1];
48 | $utime = $stat_array[13];
49 | $stime = $stat_array[14];
50 | $vsize = $stat_array[22];
51 | $meminfo = number_format($vsize, 0, '.', ',');
52 | $u_time = number_format($utime / 100, 2, '.', ',');
53 | $s_time = number_format($stime / 100, 2, '.', ',');
54 |
55 | $fd = @fopen("/proc/stat", "r");
56 | if ($fd !== false) {
57 | $stat = fread($fd, 1024);
58 | fclose($fd);
59 |
60 | $stat = str_replace(" ", " ", $stat);
61 | $stat_array_2 = explode(" ", $stat);
62 | $totalutime = $stat_array_2[1];
63 | $totalstime = $stat_array_2[3];
64 | $u_percent = number_format($utime / $totalutime, 6, '.', ',');
65 | $s_percent = number_format($stime / $totalstime, 6, '.', ',');
66 |
67 | $this->ircClass->privMsg($channel, "cpu usage: " . $u_time . "s user (" . $u_percent .
68 | "%), " . $s_time . "s system (" . $s_percent . "%) memory usage: " . $meminfo .
69 | " bytes");
70 | $out = true;
71 | }
72 | if (!$out)
73 | $this->ircClass->privMsg($channel, "memory usage: " . $meminfo . " bytes");
74 | $this->ircClass->privMsg($channel, $this->getStatus());
75 |
76 | }
77 |
78 | }
79 |
80 | private function getStatus()
81 | {
82 | $sqlCount = 0;
83 | $bwStats = $this->ircClass->getStats();
84 |
85 | if (is_object($this->db)) {
86 | $sqlCount = $this->db->numQueries();
87 | }
88 |
89 | $bwUp = irc::intToSizeString($bwStats['BYTESUP']);
90 | $bwDown = irc::intToSizeString($bwStats['BYTESDOWN']);
91 |
92 | $fileBwUp = irc::intToSizeString($this->dccClass->getBytesUp());
93 | $fileBwDown = irc::intToSizeString($this->dccClass->getBytesDown());
94 |
95 | $txtQueue = $this->ircClass->getTextQueueLength() + 1;
96 |
97 | $ircStat = $this->ircClass->getStatusString($this->ircClass->getStatusRaw());
98 | $permin = round($sqlCount / $this->ircClass->getRunTime(), 1);
99 | $kbs = ($bwStats['BYTESUP'] + $bwStats['BYTESDOWN']) / 1024;
100 | $kbs = round($kbs / $this->ircClass->getRunTime(), 2);
101 | $status = "Status: " . number_format($sqlCount) . " SQL / $permin Q/sec (irc BW: " .
102 | $bwUp . " up, " . $bwDown . " down avg ~$kbs kbps)";
103 | return $status;
104 | }
105 | }
106 |
107 | ?>
--------------------------------------------------------------------------------
/modules/urlreveal/urlreveal.conf:
--------------------------------------------------------------------------------
1 | file urlreveal modules/urlreveal/urlreveal.php
2 |
3 | privmsg urlreveal priv_urlreveal
--------------------------------------------------------------------------------
/quickinstall.txt:
--------------------------------------------------------------------------------
1 | Linux beginner steps:
2 | apt-get install php5-cli
3 | git clone git://github.com/g2x3k/php-irc.git
4 |
5 | enter the php-irc dir
6 | now just have to edit the bot.conf file
7 | to start the bot type: php bot.php bot.conf
8 |
9 |
10 | Windows Beginner:
11 | Download php setup off php.net and install remeber to select php5-cli and sockets and pcntl under extentions
12 | theres multiple tools for using github on windows the easiest is the app located at http://windows.github.com/
13 | install and you will get a "Clone in Windows" button on https://github.com/g2x3k/php-irc
14 | in the github app you can click open containing folder... so much for the guide on how to use github lets get on with the bot
15 | i have put a start.cmd in the folder as of this update edit that to use the correct .conf
16 |
17 |
18 | tips: you can rename bot.conf to etc freenode.conf
19 | tips: to launch in background use nohup like: nohup php -f bot.php some.conf >> /dev/null &
20 | tips: You can run php-irc with the -c switch to get an md5 password hash to set dccadminpass with.
21 |
22 |
23 | Edit the php.ini file following the steps in section 3-b
24 | and Of course, I recommend that you read the rest of the README file,
25 | as it provides some very important information.
--------------------------------------------------------------------------------
/start.cmd:
--------------------------------------------------------------------------------
1 | @echo off
2 | php -f bot.php bot.conf
3 | pause
--------------------------------------------------------------------------------
/start.sh:
--------------------------------------------------------------------------------
1 | #! /bin/sh
2 | php -f bot.php bot.conf
--------------------------------------------------------------------------------
/startb.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | cd /home/your_bot_folder
3 | php bot.php bot.conf > /dev/null &
4 | PID=$!
5 | echo $PID > /home/your_bot_folder/php-irc.pid
--------------------------------------------------------------------------------
/typedefs.conf:
--------------------------------------------------------------------------------
1 | type file ~ ;----Used to import files
2 | name ~ ;----the module name
3 | filename
4 |
5 | type section ~ ;----Used to section functions in dcc chat (used with 'help')
6 | name ~ ;-id name to specify with dcc function
7 | longname ~ ;-section name displayed when 'help' is pressed
8 |
9 | type ctcp ~ ;----handle all ctcp commands
10 | name ~ ;----the command typed (or trigger, like !list)
11 | module ~
12 | function
13 |
14 | type priv ~ ;----Used to process input of users in channels
15 | name ~
16 | active ~
17 | inform ~
18 | canDeactivate ~
19 | usage ~
20 | module ~
21 | function
22 |
23 | type dcc ~ ;----Used to process input of users in dcc interface
24 | name ~
25 | numArgs ~
26 | usage ~
27 | help ~
28 | admin ~
29 | module ~
30 | function ~
31 | section ;--added 2.2.0
32 |
33 | type privmsg ~ ;----Used to process privmsg irc command
34 | module ~
35 | function
36 |
37 | type notice ~ ;----Used to process notice irc command
38 | module ~
39 | function
40 |
41 | type mode ~ ;----Used to process mode irc command
42 | module ~
43 | function
44 |
45 | type join ~ ;----Used to process join irc command
46 | module ~
47 | function
48 |
49 | type kick ~ ;----Used to process kick irc command
50 | module ~
51 | function
52 |
53 | type part ~ ;----Used to process part irc command
54 | module ~
55 | function
56 |
57 | type quit ~ ;----Used to process quit irc command
58 | module ~
59 | function
60 |
61 | type connect ~ ;----Perform on connect
62 | module ~ ;----Note this is really 004 from irc
63 | function
64 |
65 | type disconnect ~ ;----Perform on disconnect $line['text'] holds reason
66 | module ~ ;----Note, this is really ERROR from irc
67 | function
68 |
69 | type raw ~
70 | module ~
71 | function
72 |
73 | type action ~
74 | module ~
75 | function
76 |
--------------------------------------------------------------------------------
/untestedmods/Half_Life_RCON_0_1/hlserver.conf:
--------------------------------------------------------------------------------
1 | file hlserver modules/hlserver/hlserver.php
2 |
3 | priv !reload true true true 0 hlserver reload_ini
4 | priv !say true true true 0 hlserver priv_say
--------------------------------------------------------------------------------
/untestedmods/Half_Life_RCON_0_1/hlserver.ini:
--------------------------------------------------------------------------------
1 | [server]
2 | ip=1.2.3.4
3 | port=27015
4 | password=mypass
5 | channel=#mychannel
6 |
7 | [local]
8 | ip=5.6.7.8
9 | port=7130
10 |
11 | [logging]
12 | kills=0
13 | says=1
14 | teamsays=1
15 | serversays=1
16 |
17 | [colors]
18 | blue=12
19 | red=4
--------------------------------------------------------------------------------
/untestedmods/Half_Life_RCON_0_1/hlserver.php:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/g2x3k/php-irc/06bacec6fd2f418f55ca8c61bda267928fe843ee/untestedmods/Half_Life_RCON_0_1/hlserver.php
--------------------------------------------------------------------------------
/untestedmods/Half_Life_RCON_0_1/readme.md:
--------------------------------------------------------------------------------
1 | # hl recon mod
2 |
3 | This is the first release of the Half-Life RCON Module for PHP-IRC 2.2.1
4 |
5 | At the moment it's really basic, but it can be expanded and customized to great depth
6 |
7 | Current functionalities:
8 | - Getting live server logs from a HL1 game server
9 | - Parsing the logs into kills and chat messages (be it from players or the server itself)
10 | - Send the parsed info to a specified irc channel
11 | - Send chat messages from irc to the server
12 |
13 | Installation notes:
14 | - Unzip hlserver.ini, hlserver.conf and hlserver.php to "Your bot's directory"/modules/hlserver
15 | - Edit hlserver.ini (This should be pretty self explaining, but see below for more detailed information)
16 | - Edit the function.conf file, add "include modules/hlserver/hlserver.conf" (without the quotes)
17 | - (re-)start / reload the bot
18 |
19 | Editing hlserver.ini:
20 | [server]
21 | ip=1.2.3.4 The game server ip address
22 | port=27015 The game server port
23 | password=mypass The RCON password (you won't be able to run this script without the correct rcon password)
24 | channel=#mychannel The channel you want to send the logs to
25 |
26 | [local]
27 | ip=5.6.7.8 The internet address (WAN IP) of the server running your bot
28 | port=7130 The port to which the logs need to be send, make sure this port is open and routed to the right server
29 |
30 | [logging]
31 | kills=0 Log kills to irc (0=off / 1=on)
32 | says=1 Log chat messages to irc (0=off / 1=on)
33 | teamsays=1 Log team chat messages to irc (0=off / 1=on)
34 | serversays=1 Log server chat messages to irc (0=off / 1=on)
35 |
36 | [colors] Used to change a player's name on irc
37 | blue=12 I created this script using TFC and i dont know the team names of other mods
38 | red=4 You will have to check some logs to find this out and change it accordingly
39 | !!!! ALWAYS use lowercase team names, else this wont work !!!!
--------------------------------------------------------------------------------
/untestedmods/Shoutcast_Status_1_04/readme.md:
--------------------------------------------------------------------------------
1 | #Shoutcast_Status
2 |
3 | Displays Stations Name and Track. I can add more fields and such from the shoutcast if asked
--------------------------------------------------------------------------------
/untestedmods/Shoutcast_Status_1_04/shoutcast_status.conf:
--------------------------------------------------------------------------------
1 | file shoutcast_status modules/shoutcast_status/shoutcast_status.php
2 |
3 | ; !shoutcaston (by oper only) to enable the shoutcast announcer
4 | priv !shoutcaston true true true 0 shoutcast_status shoutcaston
5 |
6 | ; !shoutcastoff (by oper only) to disable the shoutcast announcer
7 | priv !shoutcastoff true true true 0 shoutcast_status shoutcastoff
8 |
--------------------------------------------------------------------------------
/untestedmods/Shoutcast_Status_1_04/shoutcast_status.php:
--------------------------------------------------------------------------------
1 | functionEnabled = false;
22 | $this->timerClass->removeTimer("announce_timer");
23 | }
24 |
25 | public function shoutcaston($line, $args){
26 | //Not Oper ?
27 | if(!$this->ircClass->isMode($line['fromNick'], $line['to'], "o")){
28 | $raw = "PRIVMSG ".$line['fromNick']." Command Can Only Be Ran By Channel Ops";
29 | $this->ircClass->sendRaw($raw,true);
30 | return;
31 | //
32 | }elseif($this->functionEnabled === false){
33 | //Enable
34 | $raw = "PRIVMSG ".$line['fromNick']." Command Accepted. Atempting Connection";
35 | $this->ircClass->sendRaw($raw,true);
36 | $this->timerClass->addTimer("announce_timer", $this, "shoutcastannounce", $line['to'], $this->AnnounceTime, true);
37 | $this->functionEnabled = true;
38 | //
39 | //Already Executed?
40 | }else{
41 | $raw = "PRIVMSG ".$line['fromNick']." Shoutcast Already Enabled ".$line['fromNick'];
42 | $this->ircClass->sendRaw($raw,true);
43 | };
44 | //
45 | //
46 | }
47 |
48 | public function shoutcastoff($line, $args){
49 | //Not Oper ?
50 | if(!$this->ircClass->isMode($line['fromNick'], $line['to'], "o")){
51 | $raw = "PRIVMSG ".$line['fromNick']." Command Can Only Be Ran By Channel Ops";
52 | $this->ircClass->sendRaw($raw,true);
53 | $this->functionEnabled = false;
54 | return;
55 | //
56 | }elseif($this->functionEnabled === true){
57 | //Disable
58 | $raw = "PRIVMSG ".$line['fromNick']." Command Accepted. Killing Connection";
59 | $this->ircClass->sendRaw($raw,true);
60 | $this->timerClass->removeTimer("announce_timer");
61 | $this->functionEnabled = false;
62 | //
63 | //Already Executed?
64 | }else{
65 | $raw = "PRIVMSG ".$line['fromNick']." Shoutcast Already Disabled ".$line['fromNick'];
66 | $this->ircClass->sendRaw($raw,true);
67 | };
68 | //
69 | //
70 | }
71 |
72 | //Timer Set, Show Stats
73 | public function shoutcastannounce($Channel){
74 | //If Not Enabled
75 | if(!$this->functionEnabled){return;}else{
76 | //Announce
77 | $sc = new hn_ShoutcastInfo();
78 | $sc->query_URL($this->SourceStream,$this->AccessProxy);
79 | $Station = $sc->station();
80 | $Title = $sc->song();
81 |
82 | switch($sc->is_online()){
83 | case '0': $Online = 'Offline'; break;
84 | case '1': $Online = 'Online'; break;
85 | };
86 |
87 | if($Online == 'Online'){
88 | $raw = "PRIVMSG $Channel $Station Now Playing: $Title @ ".$sc->bandwidth();
89 | $this->ircClass->sendRaw($raw,true);
90 | $raw = "PRIVMSG $Channel Listen In @ ".$this->SourceStream."/listen.pls";
91 | $this->ircClass->sendRaw($raw,true);
92 | return true;
93 | }else{
94 | $raw = "PRIVMSG $Channel Unable To Connect To Shoutcast. Disabling ".$this->SourceStream." ".$this->AccessProxy."";
95 | $this->ircClass->sendRaw($raw,true);
96 | $this->timerClass->removeTimer("announce_timer");
97 | return;
98 | };
99 | //
100 | };
101 | //
102 | }
103 | }
104 | ?>
--------------------------------------------------------------------------------
/untestedmods/Werewolf_Game_Version_0_9b/readme.md:
--------------------------------------------------------------------------------
1 | #Werewolf Game
2 |
3 | *** Don't use this version. Use the version from Mad_Clog. He fixed the bugs. He is now handling all the updates. I will submit future updates to him, so he can check the code and fix my errors. Thanks Mad_Clog. ***
4 |
5 | This is a game that I could use some help with. It currently works, to a point. There are a few bugs with it that I need some help with.
6 |
7 | Go here for a description of the game: http://nonstophits.net/werewolf
8 |
9 | Bugs:
10 | -- First day/Night is normally shortened due to lag from the bot having too many messages to send.
11 | -- People are supposed to die if they do not vote during the day twice in a row...sometimes, at random, a person dies on the very first vote.
12 | -- Sometimes when someone is killed/lynched, it states their nick as being 0
--------------------------------------------------------------------------------
/untestedmods/Werewolf_Game_Version_0_9b/werewolf.conf:
--------------------------------------------------------------------------------
1 | ;+---------------------------------------------------------------------------
2 | ;| PHP-IRC Werewolf Game Mod
3 | ;| ========================================================
4 | ;| by Juice
5 | ;| (c) 2006 by http://www.nonstophits.net
6 | ;| Contact:
7 | ;| Email: admin@nonstophits.net
8 | ;| aim: imaqtru26
9 | ;| msn: jeff_gennusa@hotmail.com
10 | ;| icq: 120252987
11 | ;| irc: #werewolf@irc.gamesurge.net
12 | ;| ========================================
13 | ;+---------------------------------------------------------------------------
14 | ;| > This program is free software; you can redistribute it and/or
15 | ;| > modify it under the terms of the GNU General Public License
16 | ;| > as published by the Free Software Foundation; either version 2
17 | ;| > of the License, or (at your option) any later version.
18 | ;| >
19 | ;| > This program is distributed in the hope that it will be useful,
20 | ;| > but WITHOUT ANY WARRANTY; without even the implied warranty of
21 | ;| > MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 | ;| > GNU General Public License for more details.
23 | ;| >
24 | ;| > You should have received a copy of the GNU General Public License
25 | ;| > along with this program; if not, write to the Free Software
26 | ;| > Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
27 | ;+---------------------------------------------------------------------------
28 |
29 | file ww_mod modules/werewolf/werewolf.php
30 |
31 | join ww_mod onJoin
32 | nick ww_mod onNickChange
33 |
34 | priv !ww true true true 0 ww_mod parse_ww
35 | priv !start true true true 0 ww_mod parse_ww
36 | priv alive true true true 0 ww_mod alive
37 | priv join true true true 0 ww_mod joinhunt
38 | priv kill true true true 0 ww_mod kill
39 | priv role true true true 0 ww_mod role
40 | priv see true true true 0 ww_mod see
41 | priv vote true true true 0 ww_mod vote
42 |
--------------------------------------------------------------------------------
/untestedmods/autorss/autorss.conf:
--------------------------------------------------------------------------------
1 | file autorss modules/autorss/autorss.php
2 |
3 | priv !autorss true true true 0 autorss reply
4 |
--------------------------------------------------------------------------------
/untestedmods/autorss/autorss.ini:
--------------------------------------------------------------------------------
1 | [admins]
2 | hery=1222549568
3 | [config]
4 | channel=#serasera
5 | [links]
6 | 1222549711=http://feeds.feedburner.com/serasera/forum
7 | 1222550212=http://forum.serasera.org/rss/topic_t3e9652c8100ff.rss
8 | 1222550270=http://forum.serasera.org/rss/topic_t3e96528264567.rss
9 | 1222550379=http://forum.serasera.org/rss/topic_t3ead6698d828d.rss
--------------------------------------------------------------------------------
/untestedmods/autorss/readme.md:
--------------------------------------------------------------------------------
1 | #AutoRSS
2 |
3 | When you use !autorss the first time, then you become the admin. Admin can add or delete links, other admins and settings.
4 | You have to set up the channel
--------------------------------------------------------------------------------
/untestedmods/bcalc_mod/bcalc_mod.conf:
--------------------------------------------------------------------------------
1 | ;+---------------------------------------------------------------------------
2 | ;| PHP-IRC Bandwidth Calculator
3 | ;| ========================================================
4 | ;| Initial release
5 | ;| v0.1 by SubWorx
6 | ;| (c) 2007 by http://subworx.ath.cx
7 | ;| Contact:
8 | ;| email: sub@subworx.ath.cx
9 | ;| irc: #php@irc.phat-net.de
10 | ;| ========================================
11 | ;+---------------------------------------------------------------------------
12 | ;| > This program is free software; you can redistribute it and/or
13 | ;| > modify it under the terms of the GNU General Public License
14 | ;| > as published by the Free Software Foundation; either version 2
15 | ;| > of the License, or (at your option) any later version.
16 | ;| >
17 | ;| > This program is distributed in the hope that it will be useful,
18 | ;| > but WITHOUT ANY WARRANTY; without even the implied warranty of
19 | ;| > MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 | ;| > GNU General Public License for more details.
21 | ;| >
22 | ;| > You should have received a copy of the GNU General Public License
23 | ;| > along with this program; if not, write to the Free Software
24 | ;| > Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
25 | ;+---------------------------------------------------------------------------
26 | ;| Changes
27 | ;| =======-------
28 | ;| 0.1: initial release
29 | ;+---------------------------------------------------------------------------
30 |
31 | file bcalc_mod modules/bcalc_mod/bcalc_mod.php
32 |
33 | section bcalc "Bandwidth Calculator"
34 |
35 | ;priv !bcalc true true true 0 bcalc_mod priv_bcalc
36 | priv !bcalc true true true 0 bcalc_mod priv_bcalc bcalc "" "Calculates time taken to transfer at "
--------------------------------------------------------------------------------
/untestedmods/bcalc_mod/bcalc_mod.php:
--------------------------------------------------------------------------------
1 | This program is free software; you can redistribute it and/or
16 | | > modify it under the terms of the GNU General Public License
17 | | > as published by the Free Software Foundation; either version 2
18 | | > of the License, or (at your option) any later version.
19 | | >
20 | | > This program is distributed in the hope that it will be useful,
21 | | > but WITHOUT ANY WARRANTY; without even the implied warranty of
22 | | > MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 | | > GNU General Public License for more details.
24 | | >
25 | | > You should have received a copy of the GNU General Public License
26 | | > along with this program; if not, write to the Free Software
27 | | > Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
28 | +---------------------------------------------------------------------------
29 | | Changes
30 | | =======-------
31 | | 0.1: initial release
32 | +---------------------------------------------------------------------------
33 | */
34 |
35 | class bcalc_mod extends module {
36 |
37 | public $title = "Bandwidth Calculator";
38 | public $author = "SubWorx";
39 | public $version = "0.1";
40 |
41 | public function init()
42 | {
43 | }
44 |
45 | public function destroy()
46 | {
47 | }
48 |
49 | public function priv_bcalc($line, $args)
50 | {
51 | $error = 0;
52 | if ($args['nargs']<2 ) {
53 | $error = 1;
54 | }
55 |
56 | if (!is_numeric(str_replace(',', '.', $args['arg1']))) {
57 | $error = 1;
58 | }
59 |
60 | if (!is_numeric(str_replace(',', '.', $args['arg2']))) {
61 | $error = 1;
62 | }
63 |
64 | $args['arg1'] = str_replace(',', '.', $args['arg1']);
65 | $args['arg2'] = str_replace(',', '.', $args['arg2']);
66 |
67 | if ($args['arg1'] <= 0.1) {
68 | $error = 1;
69 | }
70 |
71 | if ($args['arg2'] <= 0.1) {
72 | $error = 1;
73 | }
74 |
75 | if ($error == 1) {
76 | $this->ircClass->privMsg($line['to'], "Usage: !bcalc ");
77 | return;
78 | }
79 |
80 |
81 | $time = round(($args['arg1'] * 1024) / $args['arg2']);
82 | $time2 = $time;
83 | if ($time > 86400) {
84 | $days = floor($time/86400);
85 | $time = $time - ($days * 86400);
86 | }
87 | if ($time > 3600) {
88 | $hours = floor($time/3600);
89 | $time = $time - ($hours * 3600);
90 | }
91 | if ($time > 60) {
92 | $mins = floor($time / 60);
93 | $time = $time - ($mins * 60);
94 | }
95 | $secs = $time;
96 |
97 | $message = "Downloading ".BOLD.$args['arg1'].BOLD." MB at ".BOLD.$args['arg2'].BOLD." kb/s will take approximately ";
98 | if (isset($days)) {
99 | $message .= BOLD.$days.BOLD." d ";
100 | }
101 | if (isset($hours)) {
102 | $message .= BOLD.$hours.BOLD." h ";
103 | }
104 | if (isset($mins)) {
105 | $message .= BOLD.$mins.BOLD." m ";
106 | }
107 | $message .= BOLD.$secs.BOLD." s.";
108 | $this->ircClass->privMsg($line['to'], $message);
109 |
110 | $timestamp = time();
111 | $destDay = date('l', $timestamp+$time2);
112 | $destDate = date('d.m.y', $timestamp+$time2);
113 | $destTime = date('H:i:s', $timestamp+$time2);
114 |
115 | $this->ircClass->privMsg($line['to'], "Download will be finished on ".BOLD.$destDay.BOLD.", ".BOLD.$destDate.BOLD." at ".BOLD.$destTime.BOLD.".");
116 | }
117 |
118 | }
119 |
120 | ?>
--------------------------------------------------------------------------------
/untestedmods/bcalc_mod/readme.md:
--------------------------------------------------------------------------------
1 | #Bandwidth Calculator Mod
2 |
3 | v0.1 (c) 2007 by SubWorx (sub@subworx.ath.cx , once i get it to work. for now, use the php-irc forums)
4 |
5 | Changelog:
6 |
7 | 2007.03.17 v0.1 - initial release
8 |
9 |
10 | This mod calculates how long it'll take a file to download
11 |
12 | Usage: !bcalc
13 |
14 | Numbers can be dot- or comma-separated.
15 |
16 | If "commands_mod" (http://www.phpbots.org/modinfo.php?mod=19) is NOT installed, open bcalc_mod.conf, uncomment the first "priv !bcalc" line and remove/comment the second one.
17 |
18 |
--------------------------------------------------------------------------------
/untestedmods/bottalk/README.md:
--------------------------------------------------------------------------------
1 | This module just make the bot say anything in a channel
2 |
3 | If you are on a channel you just use
4 |
5 | !say
6 |
7 | Otherwise you can talk to the bot using
8 |
9 | !say <#channel>
10 |
11 | Of course you need to be in the channel to be able to do that
12 |
13 | hery@serasera.org
14 |
15 |
16 |
--------------------------------------------------------------------------------
/untestedmods/bottalk/bottalk.conf:
--------------------------------------------------------------------------------
1 | file bottalk modules/bottalk/bottalk.php
2 | priv !say true true true 0 bottalk reply
--------------------------------------------------------------------------------
/untestedmods/bottalk/bottalk.php:
--------------------------------------------------------------------------------
1 | ircClass->notice($line['fromNick'], "What do you make me say?");
16 | return;
17 | }
18 |
19 | if ($line['to'] == $this->ircClass->getNick())
20 | {
21 | if (substr($args['arg1'], 0, 1) == '#')
22 | {
23 | $chan = $args['arg1'];
24 | $query = trim(substr($args['query'], (strpos($args['query'], $args['arg1'])) + (strlen($args['arg1']))));
25 | }
26 | else
27 | {
28 | $this->ircClass->notice($line['fromNick'], "Where should I say that? Please use " . BOLD . "!say #channel word to say");
29 | return;
30 | }
31 | }
32 | else
33 | {
34 | $chan = $line['to'];
35 | $query = $args['query'];
36 | }
37 |
38 | if ($this->ircClass->isOnline($line['fromNick'], $chan))
39 | {
40 | $this->ircClass->privMsg($chan, $query);
41 | }
42 | else
43 | {
44 | $this->ircClass->notice($line['fromNick'], "You need to be in " . $chan . " to do that");
45 | return;
46 | }
47 | }
48 |
49 | }
50 | ?>
--------------------------------------------------------------------------------
/untestedmods/chopper_ini/chopper_mod.conf:
--------------------------------------------------------------------------------
1 | ;+---------------------------------------------------------------------------
2 | ;| PHP-IRC Channel Opper w/ INI
3 | ;| by Jason Hines
4 | ;+---------------------------------------------------------------------------
5 | ;| > This program is free software; you can redistribute it and/or
6 | ;| > modify it under the terms of the GNU General Public License
7 | ;| > as published by the Free Software Foundation; either version 2
8 | ;| > of the License, or (at your option) any later version.
9 | ;| >
10 | ;| > This program is distributed in the hope that it will be useful,
11 | ;| > but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | ;| > MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | ;| > GNU General Public License for more details.
14 | ;| >
15 | ;| > You should have received a copy of the GNU General Public License
16 | ;| > along with this program; if not, write to the Free Software
17 | ;| > Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 | ;+---------------------------------------------------------------------------
19 |
20 | file chopper_mod modules/chopper_ini/chopper_mod.php
21 |
22 | join chopper_mod handle_onjoin
23 |
--------------------------------------------------------------------------------
/untestedmods/chopper_ini/chopper_mod.php:
--------------------------------------------------------------------------------
1 |
6 | +---------------------------------------------------------------------------
7 | | > This program is free software; you can redistribute it and/or
8 | | > modify it under the terms of the GNU General Public License
9 | | > as published by the Free Software Foundation; either version 2
10 | | > of the License, or (at your option) any later version.
11 | | >
12 | | > This program is distributed in the hope that it will be useful,
13 | | > but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | | > MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | | > GNU General Public License for more details.
16 | | >
17 | | > You should have received a copy of the GNU General Public License
18 | | > along with this program; if not, write to the Free Software
19 | | > Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 | +---------------------------------------------------------------------------
21 | */
22 |
23 |
24 | class chopper_mod extends module {
25 |
26 | public $title = "Chopper Mask";
27 | public $author = "oweff";
28 | public $version = "0.1";
29 |
30 | public function handle_onjoin($line, $args) {
31 | $nick = $line['fromNick'];
32 | $hostmask = $line['fromIdent'] . "@" . $line['fromHost'];
33 | $channel = $line['text'];
34 | if ($channel == $this->ircClass->getNick()) {
35 | return;
36 | }
37 | if ($nick == $this->ircClass->getNick()) {
38 | return;
39 | }
40 |
41 | $ini = new ini("modules/chopper_ini/hosts.ini");
42 |
43 | $_ops = $ini->getVars($channel);
44 | foreach ($_ops as $_hm=>$_mode) {
45 | $_mode = trim($_mode);
46 | //$this->ircClass->privMsg($channel,"Does {$hostmask} match {$_hm}?");
47 | if ($this->ircClass->hostMasksMatch($hostmask,$_hm)) {
48 | //$this->ircClass->privMsg($channel,"Yep. Granting +{$_mode} to {$nick} in {$channel}.");
49 | $this->ircClass->changeMode($channel, "+", $_mode, $nick);
50 | break;
51 | }
52 | }
53 | }
54 |
55 | }
56 |
57 | ?>
58 |
--------------------------------------------------------------------------------
/untestedmods/chopper_ini/hosts.ini:
--------------------------------------------------------------------------------
1 | [#channel]
2 | jourmom@somedomain.com = o
3 | mymom@anotherplace.net = o
4 | hismom@footown.net = v
5 |
--------------------------------------------------------------------------------
/untestedmods/chopper_ini/readme.md:
--------------------------------------------------------------------------------
1 | #The Chopper (INI)
2 |
3 | Short for channel opper, the Chopper automatically gives channel modes to specific people as they join the channel. The list of channels, hostmasks, and modes are stored in an INI file.
4 |
5 | ##REAME
6 | Chopper INI for PHP-IRC
7 | Jason Hines
8 | ----------------------------------
9 |
10 | Quite a simple module. When a user joins the channel, it matches
11 | the user's hostmask with a list stored in INI format. If it finds
12 | a match, it gives that user the appropriate channel mode.
13 |
14 | The format of hosts.ini:
15 |
16 | [#channel]
17 | jourmom@somedomain.com = o
18 | mymom@anotherplace.net = o
19 | hismom@footown.net = v
20 |
21 | You can define as many channels and hostmasks as you like. The only
22 | drawback is that the hostmask much be exact. (no patterns or wildcards)
23 | It relies on PHP-IRC's IRC::hostMasksMatch() which doesn't provide this
24 | support. .. And I'm lazy.
25 |
26 |
--------------------------------------------------------------------------------
/untestedmods/commands_mod_0_2/commands_mod.conf:
--------------------------------------------------------------------------------
1 | ;+---------------------------------------------------------------------------
2 | ;| PHP-IRC PA Mod WITH MySQL
3 | ;| ========================================================
4 | ;| by aragno
5 | ;| (c) 2001-2004 by http://phpbots.sf.net
6 | ;| Contact: aragno@oestby.com
7 | ;| ========================================
8 | ;+---------------------------------------------------------------------------
9 | ;| > This program is free software; you can redistribute it and/or
10 | ;| > modify it under the terms of the GNU General Public License
11 | ;| > as published by the Free Software Foundation; either version 2
12 | ;| > of the License, or (at your option) any later version.
13 | ;| >
14 | ;| > This program is distributed in the hope that it will be useful,
15 | ;| > but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | ;| > MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | ;| > GNU General Public License for more details.
18 | ;| >
19 | ;| > You should have received a copy of the GNU General Public License
20 | ;| > along with this program; if not, write to the Free Software
21 | ;| > Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 | ;+---------------------------------------------------------------------------
23 |
24 | file commands_mod modules/commands/commands_mod.php
25 |
26 | section help "help functions"
27 |
28 | ;Command mod 0.1 by Aragno
29 | priv !help true true true 0 commands_mod priv_commands help "" "Sends list of available commands"
30 | priv !commands true true true 0 commands_mod priv_commands help "" "Alias of !help"
31 |
--------------------------------------------------------------------------------
/untestedmods/commands_mod_0_2/commands_mod.php:
--------------------------------------------------------------------------------
1 | This program is free software; you can redistribute it and/or
12 | | > modify it under the terms of the GNU General Public License
13 | | > as published by the Free Software Foundation; either version 2
14 | | > of the License, or (at your option) any later version.
15 | | >
16 | | > This program is distributed in the hope that it will be useful,
17 | | > but WITHOUT ANY WARRANTY; without even the implied warranty of
18 | | > MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 | | > GNU General Public License for more details.
20 | | >
21 | | > You should have received a copy of the GNU General Public License
22 | | > along with this program; if not, write to the Free Software
23 | | > Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
24 | +---------------------------------------------------------------------------
25 |
26 | A small module to to provide a generic !help for all modules (the ones you want to)
27 |
28 | Requirements:
29 |
30 | You need to change the typedefs.conf.
31 | Change the priv section to:
32 |
33 | type priv ~ ;----Used to process input of users in channels
34 | name ~
35 | active ~
36 | inform ~
37 | canDeactivate ~
38 | usage ~
39 | module ~
40 | function ~
41 | section ~ ;---- String - section
42 | args ~ ;---- String - etc. like dcc usage
43 | help ;---- String - Description of the function
44 |
45 | The change to typedefs.conf will ofc make mods with their current config files from working as the conf file won't load right.
46 | Just add 'null "" ""' at the end of them and they will work as before.
47 |
48 | Any function that has "" (empty string) for the help part will not display help (if there are functions you do not
49 | wish to advertise).
50 |
51 | You also need to add a section description to the module you are implementing help for.
52 |
53 | See the commands_mod.conf for an example
54 |
55 | */
56 |
57 | /**
58 | * Class commands_mod
59 | *
60 | */
61 | class commands_mod extends module {
62 |
63 | public $title = "Command list Mod";
64 | public $author = "Aragno";
65 | public $version = "0.1";
66 | public $dontShow = true;
67 |
68 |
69 | /**
70 | * Send message
71 | *
72 | * If the message is sent as a pm we pm back else we notice to users channel
73 | *
74 | * Less clutter
75 | *
76 | * @param string $to
77 | * @param string $msg
78 | * @param string $from
79 | */
80 | private function doMessage($to, $msg, $from)
81 | {
82 | if ($to == $this->ircClass->getNick())
83 | {
84 | $this->ircClass->privMsg($from, $msg);
85 | }
86 | else
87 | {
88 | $this->ircClass->notice($from, $msg);
89 | }
90 | }
91 |
92 | /**
93 | * Output a list of commands available to the users
94 | *
95 | * Based on the dcc_help function
96 | *
97 | * @param array $line
98 | * @param array $args
99 | */
100 | public function priv_commands($line, $args)
101 | {
102 | $channel = $line['to'];
103 | $fromNick = $line['fromNick'];
104 |
105 | $cmdList = $this->parserClass->getCmdList('priv');
106 | $sectionList = $this->parserClass->getCmdList('section');
107 |
108 | if ($args['nargs'] > 0)
109 | {
110 | $cmd = $args['arg1'];
111 |
112 | if (isset($cmdList[$cmd]))
113 | {
114 | $this->doMessage($channel, "Usage: " . $cmd . " " . $cmdList[$cmd]['args'], $fromNick);
115 | $this->doMessage($channel, "Section: " . $sectionList[$cmdList[$cmd]['section']]['longname'], $fromNick);
116 | $this->doMessage($channel, "Description: " . $cmdList[$cmd]['help'], $fromNick);
117 | }
118 | else
119 | {
120 | $this->doMessage($channel, "Invalid Command: " . $line['arg1'],$fromNick);
121 |
122 | }
123 | return;
124 | }
125 |
126 | $this->doMessage($channel, "Commands:",$fromNick);
127 |
128 | $sections = array();
129 |
130 | foreach ($cmdList AS $cmd => $cmdData)
131 | {
132 | // Older mods without the added info will not display help msg until added
133 | if ($cmdList[$cmd]['help'] == "")
134 | {
135 | continue;
136 | }
137 |
138 | $sections[$cmdData['section']][] = strtoupper($cmd) . " - " . $cmdData['help'];
139 | }
140 |
141 | foreach ($sections AS $section => $data)
142 | {
143 | $this->doMessage($channel, $sectionList[$section]['longname'],$fromNick);
144 |
145 | foreach ($data AS $cmd)
146 | {
147 | $this->doMessage($channel, "-- " . $cmd, $fromNick);
148 | }
149 | }
150 |
151 | $this->doMessage($channel, "Use !help for a list of arguments",$fromNick);
152 |
153 | }
154 | }
155 | ?>
--------------------------------------------------------------------------------
/untestedmods/commands_mod_0_2/readme.md:
--------------------------------------------------------------------------------
1 | A small module to to provide a generic !help for all modules (the ones you want to)
2 |
3 | Requirements:
4 |
5 | You need to change the typedefs.conf.
6 | Change the priv section to:
7 |
8 | type priv ~ ;----Used to process input of users in channels
9 | name ~
10 | active ~
11 | inform ~
12 | canDeactivate ~
13 | usage ~
14 | module ~
15 | function ~
16 | section ~ ;---- String - section
17 | args ~ ;---- String - etc. like dcc usage
18 | help ;---- String - Description of the function
19 |
20 | The change to typedefs.conf will ofc make mods with their current config files from working as the conf file won't load right.
21 | Just add 'null "" ""' at the end of them and they will work as before.
22 |
23 | Any function that has "" (empty string) for the help part will not display help (if there are functions you do not
24 | wish to advertise).
25 |
26 | You also need to add a section description to the module you are implementing help for.
27 |
28 | See the commands_mod.conf for an example
--------------------------------------------------------------------------------
/untestedmods/dice/dice_mod.conf:
--------------------------------------------------------------------------------
1 | ;+---------------------------------------------------------------------------
2 | ;| PHP-IRC dice module Function Configuration File
3 | ;+---------------------------------------------------------------------------
4 |
5 | file dice_mod modules/dice/dice_mod.php
6 |
7 | priv !rollstats true true true 0 dice_mod roll_stats
8 | priv !roll true true true 0 dice_mod roll_die
--------------------------------------------------------------------------------
/untestedmods/dice/dice_mod.php:
--------------------------------------------------------------------------------
1 | ircClass->privMsg($channel, $msg);
28 | }
29 |
30 | public function roll_die($line, $args) {
31 | $channel = $line['to'];
32 | if ($args['nargs'] <= 0) {
33 | $msg = "Usage: !roll <#dice>d<#sides> (+value) - ex: !roll 3d6, or !roll 2d6 +1";
34 | $this->ircClass->privMsg($channel, $msg);
35 | return;
36 | }
37 | $string = $args['arg1'];
38 | list($num, $side) = split("d", $string);
39 | $number = intval($num);
40 | $sides = intval($side);
41 |
42 | if (($number > 100) or ($sides > 100)) {
43 | $msg = "Sorry, but that seems a bit much, I do not think you ment to roll that.";
44 | $this->ircClass->privMsg($channel, $msg);
45 | return;
46 | }
47 |
48 | $result = RollDie($number, $sides);
49 | $result = $result + $args['arg2'];
50 | $msg = "Rolling ".$string . $args['arg2'] . " : ".$result;
51 | $this->ircClass->privMsg($channel, $msg);
52 | return;
53 | }
54 | }
55 |
56 | #
57 | # Helper Functions
58 | #
59 |
60 | function RollDie ( $number_of_die, $number_of_sides ) {
61 | # Simple Die Roller.
62 | $total = 0;
63 | if ($number_of_sides == 0) { return($total); }
64 | for ($times = 0; $times < $number_of_die; $times++) {
65 | $roll = rand(1, $number_of_sides);
66 | $total = $total + $roll;
67 | }
68 | return($total);
69 | }
70 |
71 | function maxdice () {
72 | $total=0;
73 |
74 | $roll1 = RollDie(1,6);
75 | $roll2 = RollDie(1,6);
76 | $roll3 = RollDie(1,6);
77 | $roll4 = RollDie(1,6);
78 |
79 | $min = min($roll1, $roll2, $roll3, $roll4);
80 | if ($min == $roll1) {
81 | $total = $roll2 + $roll3 + $roll4;
82 | } else if ($min == $roll2) {
83 | $total = $roll1 + $roll3 + $roll4;
84 | } else if ($min == $roll3) {
85 | $total = $roll1 + $roll2 + $roll4;
86 | } else if ($min == $roll4) {
87 | $total = $roll1 + $roll2 + $roll3;
88 | }
89 | return $total;
90 | }
91 |
92 | ?>
--------------------------------------------------------------------------------
/untestedmods/dice/readme.md:
--------------------------------------------------------------------------------
1 | #Die Roller
2 |
3 | Here is a simple die roller.
--------------------------------------------------------------------------------
/untestedmods/gamefaqs.com/gamefaqs_mod.conf:
--------------------------------------------------------------------------------
1 | file gamefaqs_mod modules/gamefaqs.com/gamefaqs_mod.php
2 | priv !games true true true 0 gamefaqs_mod parse_gamefaqs
3 |
--------------------------------------------------------------------------------
/untestedmods/gamefaqs.com/gamefaqs_mod.php:
--------------------------------------------------------------------------------
1 | cache = array();
11 | }
12 |
13 | public function destroy()
14 | {
15 | $this->cache = array();
16 | }
17 |
18 | public function parse_gamefaqs($line, $args)
19 | {
20 |
21 | $nick = $line['fromNick'];
22 |
23 | if ($args['nargs'] < 1)
24 | {
25 | $this->ircClass->notice($line['fromNick'], "Usage: !games PLATFORM, available platforms are: GBA GC PC PS2 XBOX PSP 360 DS WII PS3");
26 | return;
27 | }
28 |
29 | $arg = strtoupper($args['arg1']);
30 |
31 | if ($arg != "PS3" && $arg != "WII" && $arg != "PC" && $arg != "GC" && $arg != "PS2" && $arg != "XBOX" && $arg != "GBA" && $arg != "PSP" && $arg != "360" && $arg != "DS") {
32 | $this->ircClass->notice($line['fromNick'], "Usage: !games PLATFORM, available platforms are: GBA GC PC PS2 XBOX PSP 360 DS WII PS3");
33 | $this->ircClass->notice($line['fromNick'], "Usage: !games PLATFORM REGION, available regions are: US NTSC EU PAL");
34 | return;
35 | }
36 |
37 | if($args['nargs'] > 1) {
38 | $arg1 = strtoupper($args['arg2']);
39 | if($arg1 != "PAL" && $arg1 != "US" && $arg1 != "EU" && $arg1 != "NTSC") {
40 | $this->ircClass->notice($line['fromNick'], "Usage: !games PLATFORM, available platforms are: GBA GC PC PS2 XBOX PSP 360 DS WII PS3");
41 | $this->ircClass->notice($line['fromNick'], "Usage: !games PLATFORM REGION, available regions are: US NTSC EU PAL");
42 | return;
43 | }
44 | switch ($arg1) {
45 | case "EU":
46 | case "PAL":
47 | $region = "EUROPE";
48 | break;
49 | case "US":
50 | case "NTSC":
51 | $region = "US";
52 | break;
53 | }
54 | }
55 | else {
56 | $region = "US";
57 | }
58 |
59 | switch($arg) {
60 | case "PC":
61 | $url = "http://www.gamefaqs.com/computer/doswin/";
62 | break;
63 | case "GC":
64 | $url = "http://www.gamefaqs.com/console/gamecube/";
65 | break;
66 | case "PS2":
67 | $url = "http://www.gamefaqs.com/console/ps2/";
68 | break;
69 | case "XBOX":
70 | $url = "http://www.gamefaqs.com/console/xbox/";
71 | break;
72 | case "GBA":
73 | $url = "http://www.gamefaqs.com/portable/gbadvance/";
74 | break;
75 | case "PSP":
76 | $url = "http://www.gamefaqs.com/portable/psp/";
77 | break;
78 | case "360":
79 | $url = "http://www.gamefaqs.com/console/xbox360/";
80 | break;
81 | case "DS":
82 | $url = "http://www.gamefaqs.com/portable/ds/";
83 | break;
84 | case "WII":
85 | $url = "http://www.gamefaqs.com/console/wii/";
86 | break;
87 | case "PS3":
88 | $url = "http://www.gamefaqs.com/console/ps3/";
89 | break;
90 | }
91 |
92 | $this->ircClass->privMsg($line['to'], "UPCOMING {$arg} GAMES // {$region} RETAIL");
93 |
94 | $contents = file($url);
95 |
96 | $this->cache = "";
97 |
98 | $bool = false;
99 |
100 | for($i = 0; $i < count($contents); $i++)
101 | {
102 | if($region == "US") {
103 | if(trim($contents[$i]) == "