[Demande] bind pubm SQL
#11
Code :
bind pubm - * pub:mod
proc pub:mod { nick host hand chan arg } {
    set arg [stripcodes bcruag [mirc:strip $arg]]
    set host [getchanhost $nick $chan]
    set host "*!*[string range $host [string first @ $host] e]"
    set boxscan [string tolower [lrange $arg 0 end]]
    set chan [string tolower $chan]
    # Badword
    if {[sql:boxchan $chan]} {
        service:connect
        mysqlsel $::mysqlink "SELECT * FROM `box`"
        if {[mysqlresult $::mysqlink rows] ne 0} {
            while {[set row [mysqlnext $::mysqlink]] != ""} {
                set spam [lindex $row 0]
                set type [lindex $row 1]
                set protect [lindex $row 2]
                foreach words $spam {
                    if {[string match *$words* $boxscan]} {
                        if { $nick != $::botnick } {
                            putserv "PRIVMSG $::back(chan) :\[\2$type\2\] $chan $nick : $boxscan"
                            putserv "privmsg $::back(chan) :$spam <= Ok"
                        }
                    }
                }
            }
        }
        service:deconnect
    }
}

proc sql:boxchan {arg} {
    service:connect
    set res [mysqlsel $::mysqlink "select * from `chanbox` where salon = '$arg'"]
    service:deconnect
    return $res
}

Si quelqu'un a une idée @alias_angelius est aussi preneur, pour l'instant cette procédure fonctionne mais elle parait très lourde (de la latence est repérée)
Répondre Avertir


Messages dans ce sujet
bind pubm SQL - par aliasangelius - 30/03/2017, 12:03
RE: bind pubm SQL - par CrazyCat - 30/03/2017, 12:55
RE: bind pubm SQL - par aliasangelius - 30/03/2017, 13:27
RE: bind pubm SQL - par CrazyCat - 30/03/2017, 13:36
RE: bind pubm SQL - par aliasangelius - 30/03/2017, 13:41
RE: bind pubm SQL - par CrazyCat - 30/03/2017, 14:01
RE: bind pubm SQL - par aliasangelius - 30/03/2017, 14:12
RE: bind pubm SQL - par CrazyCat - 31/03/2017, 08:54
RE: bind pubm SQL - par aliasangelius - 31/03/2017, 09:59
RE: bind pubm SQL - par Strategy - 31/03/2017, 15:28
RE: bind pubm SQL - par DiXiT - 01/04/2017, 17:28
RE: bind pubm SQL - par Strategy - 01/04/2017, 19:26
RE: bind pubm SQL - par DiXiT - 01/04/2017, 21:00
RE: bind pubm SQL - par Strategy - 01/04/2017, 22:54
RE: bind pubm SQL - par CrazyCat - 01/04/2017, 23:32
RE: bind pubm SQL - par DiXiT - 01/04/2017, 23:52
RE: bind pubm SQL - par CrazyCat - 02/04/2017, 00:14
RE: bind pubm SQL - par DiXiT - 02/04/2017, 00:55

Atteindre :


Utilisateur(s) parcourant ce sujet : 1 visiteur(s)
Tchat 100% gratuit -Discutez en toute liberté