Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- bind pub - !listing listing:pub:listing
- proc listing:pub:listing {nick uhost hand channel arg} {
- global zikfile zikvianotice
- if { [string tolower $channel] ne [string tolower $::zikchannel] } { return 0; }
- if { [llength [split $arg]] == 0 } {
- putserv "NOTICE $nick : Merci de préciser ta recherche. Exemple : !listing *536*HD*"
- return 0
- }
- set ziks ""
- if { [file exists $zikfile] } {
- set file [open $zikfile r]
- } else {
- if { $zikvianotice == 0 } { putmsg $channel "$zikfile n'existe pas." }
- if { $zikvianotice == 1 } { putnotc $nick "$zikfile n'existe pas." }
- return 0
- }
- while { ![eof $file] } {
- set zik [gets $file]
- if { $zik != "" } {
- set ziks [linsert $ziks end $zik]
- }
- }
- close $file
- if { $arg != "" } {
- set pattern [string tolower $arg]
- set gotzik 0
- foreach zik $ziks {
- if { [string match -nocase $pattern $zik] } {
- incr gotzik
- if { $zikvianotice == 0 } {
- putmsg $channel "Morceau: $zik"
- }
- if { $zikvianotice == 1 } {
- putnotc $nick "$zik"
- }
- }
- }
- if { $gotzik == 0 } {
- if { $zikvianotice == 0 } {
- putmsg $channel "Aucun morceau trouvé"
- }
- if { $zikvianotice == 1 } {
- putnotc $nick "Aucun morceau trouvé"
- }
- }
- }
- }
- putlog "Zik.tcl By KiBa Loaded"
Add Comment
Please, Sign In to add comment