Guest User

Untitled

a guest
Jul 2nd, 2018
261
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
TCL 1.28 KB | None | 0 0
  1. bind pub - !listing listing:pub:listing
  2.  
  3. proc listing:pub:listing {nick uhost hand channel arg} {
  4.     global zikfile zikvianotice
  5.     if { [string tolower $channel] ne [string tolower $::zikchannel] } { return 0; }
  6.     if { [llength [split $arg]] == 0 } {
  7.         putserv "NOTICE $nick : Merci de préciser ta recherche. Exemple : !listing *536*HD*"
  8.         return 0
  9.     }
  10.     set ziks ""
  11.     if { [file exists $zikfile] } {
  12.         set file [open $zikfile r]
  13.     } else {
  14.         if { $zikvianotice == 0 } { putmsg $channel "$zikfile n'existe pas." }
  15.         if { $zikvianotice == 1 } { putnotc $nick "$zikfile n'existe pas." }
  16.         return 0
  17.     }
  18.     while { ![eof $file] } {
  19.         set zik [gets $file]
  20.         if { $zik != "" } {
  21.             set ziks [linsert $ziks end $zik]
  22.         }
  23.     }
  24.     close $file
  25.     if { $arg != "" } {
  26.         set pattern [string tolower $arg]
  27.         set gotzik 0
  28.         foreach zik $ziks {
  29.             if { [string match -nocase $pattern $zik] } {
  30.                 incr gotzik
  31.                 if { $zikvianotice == 0 } {
  32.                     putmsg $channel "Morceau: $zik"
  33.                 }
  34.                 if { $zikvianotice == 1 } {
  35.                     putnotc $nick "$zik"
  36.                 }
  37.             }
  38.         }
  39.         if { $gotzik == 0 } {
  40.             if { $zikvianotice == 0 } {
  41.                 putmsg $channel "Aucun morceau trouvé"
  42.             }
  43.             if { $zikvianotice == 1 } {
  44.                 putnotc $nick "Aucun morceau trouvé"
  45.             }
  46.         }
  47.     }
  48. }
  49.  
  50.  
  51. putlog "Zik.tcl By KiBa Loaded"
Add Comment
Please, Sign In to add comment