-Bot- Welcome to #chan - The best chan in IRC
But after a few days it started to add the "{}" symbol to the greet:
-Bot- {Welcome to #chan - The best chan in IRC}
After a week:
-Bot- {{{Welcome to #chan - The best chan in IRC}}}
Why it ads the {} ? Help please.
The whole script:
Code: Select all
# MultiGreet.tcl 1.3 for eggdrop 1.3.x by Joaquin Grech <creative1@bigfoot.com>
# always as Creative1 on irc.comunet.es (Red latina) or (Univers)
#
# I got some code from randtopic.tcl by cmwagner@sodre.net
#
# You can change anything you want but
# please let me know it, so i can improve mine or
# get some ideas :)
#
# Ok, MultiGreet say a greet each time someone joins a channel, you can add
# as many greets as you wish for each channel and the script will choose one
# each time, or you can set random off :)
#
# /msg bot greet help for more info :)
#
# Versions:
#
# MultiGreet 1.0 20-07-97 (My birthday day, my first tcl :)
# MultiGreet 1.1 21-07-97 Dcc support added, ability to set
# randomize on/off added.
# MultiGreet 1.12 21-07-97 Some fixes on unknown channels.
# MultiGreet 1.2 23-07-97 Added public support.
# Some more fixes.
# MultiGreet 1.3 20-11-97 Now it works on eggdrop 1.3.x
# More fixes.
# To the public 22-5-98 because
# I felt lazy
# greet file -- this is where the greet datafiles are stored.
# greet set file -- same as above but it is for the greets that don't
# randomize.
if {![info exists greetfile]} {
set greetfile "greetfile"
set greetsetfile "greetset"
}
bind pub - !greet pub_greet
bind join - *!*@* set_greet
bind msg - greet msg_greet
bind dcc - greet dcc_greet
proc set_greet {nick uhost hand chan} {
global random_greet setgreet botnick
if {$botnick != $nick} {
if {[info exists setgreet([string tolower $chan])] && [lindex $setgreet([string tolower $chan]) 0] != ""} {
set i $setgreet([string tolower $chan])
puthelp "NOTICE $nick :$i"
} {
foreach i [array names random_greet] {
if {[lsearch -exact [string tolower [channels]] [string tolower $i]] != -1} {
if {[lindex $random_greet([string tolower $i]) 0] != ""} {
set greet [lindex $random_greet($i) [rand [llength $random_greet($i)]]]
if {$chan == $i} {
puthelp "NOTICE $nick :$greet"
}
}
} {
unset random_greet($i)
}
}
}
}
}
proc greet_show_pub {nick uhost hand channel arg} {
global random_greet setgreet botnick
if {![matchattr $hand m|m $channel]} {
putserv "PRIVMSG $nick :Sorry, you are not authorized to use this command."
return 0
}
putserv "PRIVMSG $nick :Greets for \002$channel\002:"
if {[info exists setgreet([string tolower $channel])] && [lindex $setgreet([string tolower $channel]) 0] != ""} {
set i $setgreet([string tolower $channel])
putserv "PRIVMSG $nick :\002Greet Set to:\002 $i"
putserv "PRIVMSG $nick :Use GREET SET $channel OFF if you want to turn it off."
putserv "PRIVMSG $nick :\002Random Greets:\002"
}
set ctr 0
if {[info exists random_greet([string tolower $channel])] && [lindex $random_greet([string tolower $channel]) 0] != ""} {
foreach i $random_greet([string tolower $channel]) {
incr ctr 1
putserv "PRIVMSG $nick :\002${ctr}.\002 $i"
}
} {
putserv "PRIVMSG $nick :No greets set."
}
putserv "PRIVMSG $nick :---- \002end\002 ----"
putserv "PRIVMSG $nick :Type \002/msg $botnick greet HELP\002 for help."
return 1
}
proc greet_show {nick uhost hand arg} {
global random_greet setgreet botnick
set channel [lindex $arg 0]
if {$channel == ""} {
putserv "PRIVMSG $nick :Usage: greet <channel>"
return 0
}
if {[lsearch -exact [string tolower [channels]] [string tolower $channel]] == -1} {
putserv "PRIVMSG $nick :I am not on ${channel}."
return 0
}
if {![matchattr $hand m|m $channel]} {
putserv "PRIVMSG $nick :Sorry, you are not authorized to use this command."
return 0
}
putserv "PRIVMSG $nick :Greets for \002$channel\002:"
if {[info exists setgreet([string tolower $channel])] && [lindex $setgreet([string tolower $channel]) 0] != ""} {
set i $setgreet([string tolower $channel])
putserv "PRIVMSG $nick :\002Greet Set to:\002 $i"
putserv "PRIVMSG $nick :Use GREET SET $channel OFF if you want to turn it off."
putserv "PRIVMSG $nick :\002Random Greets:\002"
}
set ctr 0
if {[info exists random_greet([string tolower $channel])] && [lindex $random_greet([string tolower $channel]) 0] != ""} {
foreach i $random_greet([string tolower $channel]) {
incr ctr 1
putserv "PRIVMSG $nick :\002${ctr}.\002 $i"
}
} {
putserv "PRIVMSG $nick :No greets set."
}
putserv "PRIVMSG $nick :---- \002end\002 ----"
putserv "PRIVMSG $nick :Type \002/msg $botnick greet HELP\002 for help."
return 1
}
proc greet_show_dcc {hand idx arg} {
global random_greet setgreet botnick
set channel [lindex $arg 0]
if {$channel == ""} {
putidx $idx "Usage: greet <channel>"
return 0
}
if {[lsearch -exact [string tolower [channels]] [string tolower $channel]] == -1} {
putidx $idx "I am not on ${channel}."
return 0
}
if {![matchattr $hand m|m $channel]} {
putidx $idx "Sorry, you are not authorized to use this command."
return 0
}
putidx $idx "Greets for \002$channel\002:"
if {[info exists setgreet([string tolower $channel])] && [lindex $setgreet([string tolower $channel]) 0] != ""} {
set i $setgreet([string tolower $channel])
putidx $idx "\002Greet Set to:\002 $i"
putidx $idx "Use GREET SET $channel OFF if you want to turn it off."
putidx $idx "\002Random Greets:\002"
}
set ctr 0
if {[info exists random_greet([string tolower $channel])] && [lindex $random_greet([string tolower $channel]) 0] != ""} {
foreach i $random_greet([string tolower $channel]) {
incr ctr 1
putidx $idx "\002${ctr}.\002 $i"
}
} {
putidx $idx "No greets set."
}
putidx $idx "---- \002end\002 ----"
putidx $idx "Type \002.greet HELP\002 for help."
return 1
}
proc greet_set_pub {nick uhost hand channel arg} {
global setgreet
if {![matchattr $hand m|m $channel]} {
putserv "PRIVMSG $nick :Sorry, you are not authorized to use this command."
return 0
}
if {[string tolower [lindex $arg 1]] != "off"} {
putserv "PRIVMSG $nick :Greet set to:"
putserv "PRIVMSG $nick :[lrange $arg 1 end]"
set setgreet([string tolower $channel]) [lrange $arg 1 end]
} {
putserv "PRIVMSG $nick :Greet set randomize on $channel"
set setgreet([string tolower $channel]) [lreplace $setgreet([string tolower $channel]) 0 0]
}
putlog "Writing greets file..."
greet_write
return 1
}
proc greet_set {nick uhost hand arg} {
global setgreet
set channel [lindex $arg 1]
if {$channel == ""} {
putserv "PRIVMSG $nick :Usage: GREET SET <channel> <greet>"
putserv "PRIVMSG $nick :Or: GREET SET <channel> OFF"
return 0
}
if {[lsearch -exact [string tolower [channels]] [string tolower $channel]] == -1} {
putserv "PRIVMSG $nick :I am not on ${channel}."
return 0
}
if {![matchattr $hand m|m $channel]} {
putserv "PRIVMSG $nick :Sorry, you are not authorized to use this command."
return 0
}
if {[string tolower [lindex $arg 2]] != "off"} {
putserv "PRIVMSG $nick :Greet set to:"
putserv "PRIVMSG $nick :[lrange $arg 1 end]"
set setgreet([string tolower $channel]) [lrange $arg 2 end]
} {
putserv "PRIVMSG $nick :Greet set randomize on $channel"
set setgreet([string tolower $channel]) [lreplace $setgreet([string tolower $channel]) 0 0]
}
putlog "Writing greets file..."
greet_write
return 1
}
proc greet_set_dcc {hand idx arg} {
global setgreet
set channel [lindex $arg 1]
if {$channel == ""} {
putidx $idx "Usage: GREET SET <channel> <greet>"
putidx $idx "Or: GREET SET <channel> OFF"
return 0
}
if {[lsearch -exact [string tolower [channels]] [string tolower $channel]] == -1} {
putidx $idx "I am not on ${channel}."
return 0
}
if {![matchattr $hand m|m $channel]} {
putidx $idx "Sorry, you are not authorized to use this command."
return 0
}
if {[string tolower [lindex $arg 2]] != "off"} {
putidx $idx "Greet set to:"
putidx $idx "[lrange $arg 1 end]"
set setgreet([string tolower $channel]) [lrange $arg 2 end]
} {
putidx $idx "Greet set randomize on $channel"
set setgreet([string tolower $channel]) [lreplace $setgreet([string tolower $channel]) 0 0]
}
putlog "Writing greets file..."
greet_write
return 1
}
proc greet_add_pub {nick uhost hand channel arg} {
global random_greet
if {![matchattr $hand m|m $channel]} {
putserv "PRIVMSG $nick :Sorry, you are not authorized to use this command."
return 0
}
putserv "PRIVMSG $nick :Greet list has been updated, thanks."
putserv "PRIVMSG $nick :$channel [lrange $arg 1 end]"
lappend random_greet([string tolower $channel]) [lrange $arg 1 end]
putlog "Writing greets file..."
greet_write
return 1
}
proc greet_add {nick uhost hand arg} {
global random_greet
set channel [lindex $arg 1]
if {$channel == ""} {
putserv "PRIVMSG $nick :Usage: GREET ADD <channel> <new greet>"
return 0
}
if {[lsearch -exact [string tolower [channels]] [string tolower $channel]] == -1} {
putserv "PRIVMSG $nick :I am not on ${channel}."
return 0
}
if {![matchattr $hand m|m $channel]} {
putserv "PRIVMSG $nick :Sorry, you are not authorized to use this command."
return 0
}
putserv "PRIVMSG $nick :Greet list has been updated, thanks."
putserv "PRIVMSG $nick :[lrange $arg 1 end]"
lappend random_greet([string tolower $channel]) [lrange $arg 2 end]
putlog "Writing greets file..."
greet_write
return 1
}
proc greet_add_dcc {hand idx arg} {
global random_greet
set channel [lindex $arg 1]
if {$channel == ""} {
putidx $idx "Usage: GREET ADD <channel> <new greet>"
return 0
}
if {[lsearch -exact [string tolower [channels]] [string tolower $channel]] == -1} {
putidx $idx "I am not on ${channel}."
return 0
}
if {![matchattr $hand m|m $channel]} {
putidx $idx "Sorry, you are not authorized to use this command."
return 0
}
putidx $idx "Greet list has been updated, thanks."
putidx $idx "[lrange $arg 1 end]"
lappend random_greet([string tolower $channel]) [lrange $arg 2 end]
putlog "Writing greets file..."
greet_write
return 1
}
proc greet_erase_pub {nick uhost hand channel arg} {
global random_greet
if {![matchattr $hand m|m $channel]} {
putserv "PRIVMSG $nick :Sorry, you are not authorized to use this command."
return 0
}
if {![info exists random_greet([string tolower $channel])]} {
putserv "PRIVMSG $nick :No greets set."
return 0
}
set i [expr [lindex $arg 1] - 1]
if {$i >=0 && [lindex $random_greet([string tolower $channel]) $i] != ""} {
putserv "PRIVMSG $nick :Entry [lindex $arg 1] erased."
putserv "PRIVMSG $nick :$channel [lindex $random_greet([string tolower $channel]) $i]"
set random_greet([string tolower $channel]) [lreplace $random_greet([string tolower $channel]) $i $i]
putlog "Writing greets file..."
greet_write
return 1
} {
putserv "PRIVMSG $nick :That number is out of range!"
return 0
}
}
proc greet_erase {nick uhost hand arg} {
global random_greet
set channel [lindex $arg 1]
if {$channel == ""} {
putserv "PRIVMSG $nick :Usage: GREET DEL <channel> <greet#>"
return 0
}
if {[lsearch -exact [string tolower [channels]] [string tolower $channel]] == -1} {
putserv "PRIVMSG $nick :I am not on ${channel}."
return 0
}
if {![matchattr $hand m|m $channel]} {
putserv "PRIVMSG $nick :Sorry, you are not authorized to use this command."
return 0
}
if {![info exists random_greet([string tolower $channel])]} {
putserv "PRIVMSG $nick :No greets set."
return 0
}
set i [expr [lindex $arg 2] - 1]
if {$i >=0 && [lindex $random_greet([string tolower $channel]) $i] != ""} {
putserv "PRIVMSG $nick :Entry [lindex $arg 2] erased."
putserv "PRIVMSG $nick :$channel [lindex $random_greet([string tolower $channel]) $i]"
set random_greet([string tolower $channel]) [lreplace $random_greet([string tolower $channel]) $i $i]
putlog "Writing greets file..."
greet_write
return 1
} {
putserv "PRIVMSG $nick :That number is out of range!"
return 0
}
}
proc greet_erase_dcc {hand idx arg} {
global random_greet
set channel [lindex $arg 1]
if {$channel == ""} {
putidx $idx "Usage: GREET DEL <channel> <greet#>"
return 0
}
if {[lsearch -exact [string tolower [channels]] [string tolower $channel]] == -1} {
putidx $idx "I am not on ${channel}."
return 0
}
if {![matchattr $hand m|m $channel]} {
putidx $idx "Sorry, you are not authorized to use this command."
return 0
}
if {![info exists random_greet([string tolower $channel])]} {
putidx $idx "No greets set."
return 0
}
set i [expr [lindex $arg 2] - 1]
if {$i >=0 && [lindex $random_greet([string tolower $channel]) $i] != ""} {
putidx $idx "Entry [lindex $arg 2] erased."
putidx $idx "$channel [lindex $random_greet([string tolower $channel]) $i]"
set random_greet([string tolower $channel]) [lreplace $random_greet([string tolower $channel]) $i $i]
putlog "Writing greets file..."
greet_write
return 1
} {
putidx $idx "That number is out of range!"
return 0
}
}
proc greet_help_pub {nick uhost hand channel arg} {
putserv "PRIVMSG $nick :Usage: GREET - show greets"
putserv "PRIVMSG $nick : GREET ADD <new greet> - add greet entry"
putserv "PRIVMSG $nick : GREET DEL <greet#> - delete greet entry"
putserv "PRIVMSG $nick : GREET SET <greet> - set a greet for a channel (no randomize)"
putserv "PRIVMSG $nick : GREET SET OFF - set randomize on"
return 1
}
proc greet_help {nick uhost hand arg} {
putserv "PRIVMSG $nick :Usage: GREET - show greets"
putserv "PRIVMSG $nick : GREET ADD <channel> <new greet> - add greet entry"
putserv "PRIVMSG $nick : GREET DEL <channel> <greet#> - delete greet entry"
putserv "PRIVMSG $nick : GREET SET <channel> <greet> - set a greet for a channel (no randomize)"
putserv "PRIVMSG $nick : GREET SET <channel> OFF - set randomize on"
return 1
}
proc greet_help_dcc {hand idx arg} {
putidx $idx "Usage: GREET - show greets"
putidx $idx " GREET ADD <channel> <new greet> - add greet entry"
putidx $idx " GREET DEL <channel> <greet#> - delete greet entry"
putidx $idx " GREET SET <channel> <greet> - set a greet for a channel (no randomize)"
putidx $idx " GREET SET <channel> OFF - set randomize on"
return 1
}
proc greet_load {} {
global random_greet setgreet greetfile greetsetfile
if {[info exists random_greet]} {unset random_greet}
if {[catch {set fd [open $greetfile r]}] != 0} {return 0}
while {![eof $fd]} {
set inp [gets $fd]
if {[eof $fd]} {break}
if {[string trim $inp " "] == ""} {continue}
set channel [lindex $inp 0]
lappend random_greet([string tolower $channel]) [lrange $inp 1 end]
}
close $fd
if {[info exists setgreet]} {unset setgreet}
if {[catch {set fd [open $greetsetfile r]}] != 0} {return 0}
while {![eof $fd]} {
set inp [gets $fd]
if {[eof $fd]} {break}
if {[string trim $inp " "] == ""} {continue}
set channel [lindex $inp 0]
lappend setgreet([string tolower $channel]) [lrange $inp 1 end]
}
close $fd
return 1
}
proc greet_write {} {
global greetfile random_greet setgreet greetsetfile
set fd [open $greetfile w]
foreach channel [array names random_greet] {
if {[lsearch -exact [string tolower [channels]] [string tolower $channel]] != -1} {
if {[lindex $random_greet([string tolower $channel]) 0] != ""} {
foreach i $random_greet([string tolower $channel]) {
puts $fd "$channel $i"
}
}
}
}
close $fd
set fd [open $greetsetfile w]
foreach channel [array names setgreet] {
if {[lsearch -exact [string tolower [channels]] [string tolower $channel]] != -1} {
if {[lindex $setgreet([string tolower $channel]) 0] != ""} {
set i $setgreet([string tolower $channel])
puts $fd "$channel $i"
}
}
}
close $fd
return 1
}
proc msg_greet {nick uhost hand arg} {
switch [string tolower [lindex $arg 0]] {
"add" {set r [greet_add $nick $uhost $hand $arg]}
"del" {set r [greet_erase $nick $uhost $hand $arg]}
"delete" {set r [greet_erase $nick $uhost $hand $arg]}
"set" {set r [greet_set $nick $uhost $hand $arg]}
"help" {set r [greet_help $nick $uhost $hand $arg]}
default {set r [greet_show $nick $uhost $hand $arg]}
}
return $r
}
proc pub_greet {nick uhost hand channel arg} {
switch [string tolower [lindex $arg 0]] {
"add" {set r [greet_add_pub $nick $uhost $hand $channel $arg]}
"del" {set r [greet_erase_pub $nick $uhost $hand $channel $arg]}
"delete" {set r [greet_erase_pub $nick $uhost $hand $channel $arg]}
"set" {set r [greet_set_pub $nick $uhost $hand $channel $arg]}
"help" {set r [greet_help_pub $nick $uhost $hand $channel $arg]}
default {set r [greet_show_pub $nick $uhost $hand $channel $arg]}
}
return $r
}
proc dcc_greet {hand idx arg} {
switch [string tolower [lindex $arg 0]] {
"add" {set r [greet_add_dcc $hand $idx $arg]}
"del" {set r [greet_erase_dcc $hand $idx $arg]}
"delete" {set r [greet_erase_dcc $hand $idx $arg]}
"set" {set r [greet_set_dcc $hand $idx $arg]}
"help" {set r [greet_help_dcc $hand $idx $arg]}
default {set r [greet_show_dcc $hand $idx $arg]}
}
return $r
}
greet_load
if {![info exists set_greet_running] && ![info exists random_greet] && ![info exists setgreet]} {
set set_greet_running 1
}
putlog "\002MultiGreet 1.3\002 by Joaquin Grech <creative1> loaded."