This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.
For more information, see this announcement post . Click the X in the top right-corner of this box to dismiss this message.
Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Hugo2
Voice
Posts: 2 Joined: Thu Dec 06, 2012 3:19 pm
Post
by Hugo2 » Thu Dec 06, 2012 3:33 pm
Hello!
I have been looking for an eggdrop script that reads one or more channels and puts it into a MySql database. It will read/copy from an IRC channel and add it to a MySql database. Is there anyone who could help me with this? Or know if there is anything simular to this here on the forums? I've been looking like crazy, but I dont find anything. If you help me, I am forever grateful and can certainly give something in return.
/ Hugo2
tomekk
Master
Posts: 255 Joined: Fri Nov 28, 2008 11:35 am
Location: Oswiecim / Poland
Contact:
Post
by tomekk » Thu Dec 06, 2012 3:47 pm
Whole channel text into mysql table?
Hugo2
Voice
Posts: 2 Joined: Thu Dec 06, 2012 3:19 pm
Post
by Hugo2 » Thu Dec 06, 2012 3:57 pm
Yes, I want every entry in the channel to go to the mysql database.
tomekk
Master
Posts: 255 Joined: Fri Nov 28, 2008 11:35 am
Location: Oswiecim / Poland
Contact:
Post
by tomekk » Thu Dec 06, 2012 4:58 pm
Try this one, kinda old but should work:
Code: Select all
# Author: tomekk
# e-mail: tomekk/@/tomekk/./org
# home page: http://tomekk.org/
#
# Version 0.1
#
# This file is Copyrighted under the GNU Public License.
# http://www.gnu.org/copyleft/gpl.html
# channel_name = channel table name in database
set channels_tables { #chan1 #chan2 }
# SQL user
set sql_user "myuser"
# SQL pass
set sql_pass "mypass"
# SQL server host
set sql_host "localhost"
# SQL database
set sql_dbase "mydbname"
##############################################################
package require mysqltcl
bind pubm - "*" eat_me
proc eat_me { nick uhost hand chan arg } {
global channels_tables sql_user sql_pass sql_host sql_dbase
foreach channel_table $channels_tables {
if {$channel_table == $chan} {
set mysql_hand [::mysql::connect -host $sql_host -user $sql_user -password $sql_pass]
::mysql::use $mysql_hand $sql_dbase
set escaped_nick [::mysql::escape $mysql_hand $nick]
set escaped_arg [::mysql::escape $mysql_hand $arg]
::mysql::sel $mysql_hand "INSERT INTO `$channel_table` (`id`, `nick`, `text`) VALUES(NULL, '$escaped_nick', '$escaped_arg')"
::mysql::close $mysql_hand
}
}
}
putlog "mysqlchan.tcl ver 0.1 by tomekk loaded"
table structure:
Code: Select all
CREATE TABLE `#chan1` (
`id` INT NOT NULL AUTO_INCREMENT ,
`nick` VARCHAR( 32 ) NOT NULL ,
`text` TEXT NOT NULL ,
PRIMARY KEY ( `id` )
) ENGINE = MYISAM ;
Generally - it should work, but there can be problems with char encoding.
Try it.
/hint/
lsearch can be used instead of foreach, but anyway - this should be not a problem