Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #Music Is Knowledge
- #La base du code appartient à quote.tcl
- #Quote Script by Steinsky. Version: 1.2.1
- #See www.cotch.net, irc.fwaggle.net, irc.zone.dk and virus.eleethal.com
- #Merci donc à lui
- # Ici on précise le chemin du fichier texte
- set zikfile /mon/repertoire/music.txt
- # 0 = résultat en privmsg
- # 1 = résultat en notice
- set zikvianotice 0
- # Ici on précise le ou les channels où le bot répondra
- set zikchannel "#Chan1"
- if { ![info exists toolbox_loaded] } { source scripts/alltools.tcl }
- bind pub - !read read:pub:read
- proc read:pub:read {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"
- 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 aziks ""
- set zik ""
- foreach zik $ziks {
- set lowzik [string tolower $zik]
- if { [string match $pattern $lowzik] } {
- set aziks [linsert $aziks end $zik]
- }
- set ziks ""
- set ziks $aziks
- }
- }
- set row [rand [llength $ziks]]
- if { [expr $row >= 0] && [expr $row < [llength $ziks]] } {
- set zik [lindex $ziks $row]
- }
- if { $zik != "" } {
- if { $zikvianotice == 0 } {
- putmsg $zikchannel "Morceau: $zik"
- }
- if { $zikvianotice == 1 } {
- putnotc $nick "$zik"
- }
- }
- return 1
- }
- putlog "Zik.tcl By KiBa Loaded"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement