Am observat ca sunt probleme cu multigreet, adauga {} in greet si altele...
Poftim un greet fara aceasta problema.
Code:
####################################################################
# Author: StarteR2 #
# Email: starter2@sympatico.ca #
# Description: Greet, on join, user will receive channel's greet. #
# Version: Alpha Testing #
# #
# Known Problems: #
# #
# - If you already have a greet and you ask the bot to add #
# another greet, he will, and on join the user will get 2 #
# greets. This should be fixed #
# #
# - If you ask the bot to remove the greet he will, even if #
# there is no greets he will still say that he removed greet #
# This must be fixed
#
# - Verify doesnt work. Still don't know why.
#
# Usage:
# !greet -add <greet>
# !greet -remove
# !greet -verify (doesn't work)
#
# Install:
#
# 1) Creat an empty file name greet.db in the eggdrops main
# dir.
# Default: ~/eggdrop
#
# 2) Load the script. (i.e. source greet.tcl)
####################################################################
a:command -add greet pub:greet 1099 593 N
proc pub:greet {hand chan args x mix} {
global settings
set file "greet.db"
set aqwzsx [lindex $args 0] ;#option
set greet [join [lrange $args 1 end]] ;#reason
if {$aqwzsx == ""} {
putquick "privmsg $chan :Usage:\0032 !greet -add <greet> \0034To add a greet to your channel"
putquick "privmsg $chan :Usage:\0032 !greet -remove\0034 To remove the greet from the channel"
return
}
switch -- $aqwzsx {
-add {
set fd [open $file a+]
puts $fd "$chan $greet\n"
close $fd
puthelp "PRIVMSG $chan :\002GREET\002 Added greeting \0032$greet\0031 to channel \0034$chan"
}
-remove {
set fd [open $file r]
set reads [read $fd]
close $fd
set data ""
if {[llength $reads]} {
set fd [open $file w]
foreach line [split $reads \n] {
if {![string match -nocase "$chan*" $line]} {
if {[llength $line]} {puts $fd "$line\n"}
}
puthelp "PRIVMSG $chan :\002GREET\002 Removed greet from channel \0032$chan"
}
close $fd
}
-verify {
set fd [open $file r]
set cont [read $fd]
close $fd
foreach abuse [split $cont \n] {if {[string match -nocase "$chan*" $abuse]} {
set a1 [lindex $abuse 0] ;#chan
set b2 [join [lrange $abuse 1 end]] ;#greet
putquick "PRIVMSG $chan :Greet for channel \0034$chan\0031 is \0032$b2"}
}
}
}
}
bind join -|- * greetnote
proc greetnote {nick uhost hand chan} {
set file "greet.db"
set fd [open $file r]
set cont [read $fd]
close $fd
foreach abuse [split $cont \n] {if {[string match -nocase "$chan*" $abuse]} {
set a1 [lindex $abuse 0] ;#chan
set b2 [join [lrange $abuse 1 end]] ;#greet
putquick "NOTICE $nick :$b2"}
}
return
}
}
putlog "Alpha Greet Loaded"