botlending forum  

Go Back   botlending forum > Eggdrop & TCL > Tcl scripting

Tcl scripting Tcl scripting related questions

Reply
 
LinkBack Thread Tools Display Modes
Old 10-04-2007, 15:27   #1 (permalink)
Junior Member
 
Join Date: Apr 2007
Posts: 11
Rep Power: 0
SoLLo is an unknown quantity at this point
Arrow Welcome/Leave - Ban/Kick-Reason [4 in 1]

Imi cer scuze ca intreb despre mai multe problme intr-un singur thread !

Pentru inceput as vrea sa ma ajutati sa fac un TCL , cand iese o persoara de pe un canal sa ii dea PRIVAT si sa ii spuna "Te mai asteptam pe la noi !" sau ceva in genu.O sa postez mai jos un TCL care da PRIVAT cand intri pe canal , am incercat sa imi modific acesta dar nu am reusit si as vrea sa il fac in genul la cel cu JOIN deoarece imi place modul cum se seteaza mesajul "!welcome set <msg>" as vrea sa fac la cel cu PART "!leave set <msg>"

Code:
if {![info exists welcomefile]} {
   set welcomefile "welcomefile"
   set welcomesetfile "welcomeset"
}

bind pub - !welcome pub_welcome
bind join - *!*@* set_welcome
bind msg - welcome msg_welcome
bind dcc - welcome dcc_welcome


proc set_welcome {nick uhost hand chan} {
  global random_welcome setwelcome botnick

 if {$botnick != $nick} {
  if {[info exists setwelcome([string tolower $chan])] && [lindex $setwelcome([string tolower $chan]) 0] != ""} {
    set i $setwelcome([string tolower $chan]) 
    puthelp "PRIVMSG $nick :$i"

   } {

     foreach i [array names random_welcome] {
        if {[lsearch -exact [string tolower [channels]] [string tolower $i]] != -1} {
            if {[lindex $random_welcome([string tolower $i]) 0] != ""} {
              set welcome [lindex $random_welcome($i) [rand [llength $random_welcome($i)]]]
                if {$chan == $i} {
                  puthelp "PRIVMSG $nick :$welcome"
                }
            }
        } {
            unset random_welcome($i)
          }
      }
   }
 }
}

proc welcome_show_pub {nick uhost hand channel arg} {
  global random_welcome setwelcome botnick 


  if {![matchattr $hand m|m $channel]} {
     putserv "PRIVMSG $nick :Sorry, you are not authorized to use this command."
     return 0
  }

  putserv "PRIVMSG $nick :welcomes for \002$channel\002:"

  if {[info exists setwelcome([string tolower $channel])] && [lindex $setwelcome([string tolower $channel]) 0] != ""} {
    set i $setwelcome([string tolower $channel]) 
       putserv "PRIVMSG $nick :\002welcome Set to:\002  $i"
       putserv "PRIVMSG $nick :Use welcome SET $channel OFF if you want to turn it off."
       putserv "PRIVMSG $nick :\002Random welcomes:\002"
    }
  
  set ctr 0
  if {[info exists random_welcome([string tolower $channel])] && [lindex $random_welcome([string tolower $channel]) 0] != ""} {
    foreach i $random_welcome([string tolower $channel]) {
       incr ctr 1
       putserv "PRIVMSG $nick :\002${ctr}.\002  $i"
    }
  } {
    putserv "PRIVMSG $nick :No welcomes set."
  }
  putserv "PRIVMSG $nick :---- \002end\002 ----"
  putserv "PRIVMSG $nick :Type \002/msg $botnick welcome HELP\002 for help."

  return 1
}


proc welcome_show {nick uhost hand arg} {
  global random_welcome setwelcome botnick 

  set channel [lindex $arg 0]
  if {$channel == ""} {
     putserv "PRIVMSG $nick :Usage: welcome <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 :welcomes for \002$channel\002:"

  if {[info exists setwelcome([string tolower $channel])] && [lindex $setwelcome([string tolower $channel]) 0] != ""} {
    set i $setwelcome([string tolower $channel]) 
       putserv "PRIVMSG $nick :\002welcome Set to:\002  $i"
       putserv "PRIVMSG $nick :Use welcome SET $channel OFF if you want to turn it off."
       putserv "PRIVMSG $nick :\002Random welcomes:\002"
    }
  
  set ctr 0
  if {[info exists random_welcome([string tolower $channel])] && [lindex $random_welcome([string tolower $channel]) 0] != ""} {
    foreach i $random_welcome([string tolower $channel]) {
       incr ctr 1
       putserv "PRIVMSG $nick :\002${ctr}.\002  $i"
    }
  } {
    putserv "PRIVMSG $nick :No welcomes set."
  }
  putserv "PRIVMSG $nick :---- \002end\002 ----"
  putserv "PRIVMSG $nick :Type \002/msg $botnick welcome HELP\002 for help."

  return 1
}

proc welcome_show_dcc {hand idx arg} {
  global random_welcome setwelcome botnick 

  set channel [lindex $arg 0]
  if {$channel == ""} {
     putidx $idx "Usage: welcome <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 "welcomes for \002$channel\002:"

  if {[info exists setwelcome([string tolower $channel])] && [lindex $setwelcome([string tolower $channel]) 0] != ""} {
    set i $setwelcome([string tolower $channel]) 
       putidx $idx "\002welcome Set to:\002  $i"
       putidx $idx "Use welcome SET $channel OFF if you want to turn it off."
       putidx $idx "\002Random welcomes:\002"
    }


  set ctr 0
  if {[info exists random_welcome([string tolower $channel])] && [lindex $random_welcome([string tolower $channel]) 0] != ""} {
    foreach i $random_welcome([string tolower $channel]) {
       incr ctr 1
       putidx $idx "\002${ctr}.\002  $i"
    }
  } {
    putidx $idx "No welcomes set."
  }
  putidx $idx "---- \002end\002 ----"
  putidx $idx "Type \002.welcome HELP\002 for help."

  return 1
}

proc welcome_set_pub {nick uhost hand channel arg} {
  global setwelcome

  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 :welcome set to:"
    putserv "PRIVMSG $nick :[lrange $arg 1 end]"
    set setwelcome([string tolower $channel]) [lrange $arg 1 end]
  } {
    putserv "PRIVMSG $nick :welcome set randomize on $channel"
    set setwelcome([string tolower $channel]) [lreplace $setwelcome([string tolower $channel]) 0 0]
  }
  
  putlog "Writing welcomes file..."
  welcome_write
  
  return 1

}


proc welcome_set {nick uhost hand arg} {
  global setwelcome

  set channel [lindex $arg 1]

  if {$channel == ""} {
     putserv "PRIVMSG $nick :Usage: welcome SET <channel> <welcome>"
     putserv "PRIVMSG $nick :Or:    welcome 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 :welcome set to:"
    putserv "PRIVMSG $nick :[lrange $arg 1 end]"
    set setwelcome([string tolower $channel]) [lrange $arg 2 end]
  } {
    putserv "PRIVMSG $nick :welcome set randomize on $channel"
    set setwelcome([string tolower $channel]) [lreplace $setwelcome([string tolower $channel]) 0 0]
  }
  
  putlog "Writing welcomes file..."
  welcome_write
  
  return 1

}

proc welcome_set_dcc {hand idx arg} {
  global setwelcome

  set channel [lindex $arg 1]

  if {$channel == ""} {
     putidx $idx "Usage: welcome SET <channel> <welcome>"
     putidx $idx "Or:    welcome 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 "welcome set to:"
    putidx $idx "[lrange $arg 1 end]"
    set setwelcome([string tolower $channel]) [lrange $arg 2 end]
  } {
    putidx $idx "welcome set randomize on $channel"
    set setwelcome([string tolower $channel]) [lreplace $setwelcome([string tolower $channel]) 0 0]
  }
  
  putlog "Writing welcomes file..."
  welcome_write
  
  return 1

}

proc welcome_add_pub {nick uhost hand channel arg} {
  global random_welcome 

  if {![matchattr $hand m|m $channel]} {
     putserv "PRIVMSG $nick :Sorry, you are not authorized to use this command."
     return 0
  }

  putserv "PRIVMSG $nick :welcome list has been updated, thanks."
  putserv "PRIVMSG $nick :$channel [lrange $arg 1 end]"
  lappend random_welcome([string tolower $channel]) [lrange $arg 1 end]

  putlog "Writing welcomes file..."
  welcome_write
  

  return 1
}

proc welcome_add {nick uhost hand arg} {
  global random_welcome 

  set channel [lindex $arg 1]

  if {$channel == ""} {
     putserv "PRIVMSG $nick :Usage: welcome ADD <channel> <new welcome>"
     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 :welcome list has been updated, thanks."
  putserv "PRIVMSG $nick :[lrange $arg 1 end]"
  lappend random_welcome([string tolower $channel]) [lrange $arg 2 end]

  putlog "Writing welcomes file..."
  welcome_write
  

  return 1
}

proc welcome_add_dcc {hand idx arg} {
  global random_welcome 

  set channel [lindex $arg 1]

  if {$channel == ""} {
     putidx $idx "Usage: welcome ADD <channel> <new welcome>"
     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 "welcome list has been updated, thanks."
  putidx $idx "[lrange $arg 1 end]"
  lappend random_welcome([string tolower $channel]) [lrange $arg 2 end]

  putlog "Writing welcomes file..."
  welcome_write
  

  return 1
}

proc welcome_erase_pub {nick uhost hand channel arg} {
  global random_welcome 

  if {![matchattr $hand m|m $channel]} {
     putserv "PRIVMSG $nick :Sorry, you are not authorized to use this command."
     return 0
  }

  if {![info exists random_welcome([string tolower $channel])]} {
     putserv "PRIVMSG $nick :No welcomes set."
     return 0
  }

  set i [expr [lindex $arg 1] - 1]
  if {$i >=0 && [lindex $random_welcome([string tolower $channel]) $i] != ""} {
     putserv "PRIVMSG $nick :Entry [lindex $arg 1] erased."
     putserv "PRIVMSG $nick :$channel [lindex $random_welcome([string tolower $channel]) $i]"
     set random_welcome([string tolower $channel]) [lreplace $random_welcome([string tolower $channel]) $i $i]

     putlog "Writing welcomes file..."
     welcome_write
     
     return 1
  } {
     putserv "PRIVMSG $nick :That number is out of range!"
     return 0
  }
}


proc welcome_erase {nick uhost hand arg} {
  global random_welcome 


  set channel [lindex $arg 1]

  if {$channel == ""} {
     putserv "PRIVMSG $nick :Usage: welcome DEL <channel> <welcome#>"
     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_welcome([string tolower $channel])]} {
     putserv "PRIVMSG $nick :No welcomes set."
     return 0
  }

  set i [expr [lindex $arg 2] - 1]
  if {$i >=0 && [lindex $random_welcome([string tolower $channel]) $i] != ""} {
     putserv "PRIVMSG $nick :Entry [lindex $arg 2] erased."
     putserv "PRIVMSG $nick :$channel [lindex $random_welcome([string tolower $channel]) $i]"
     set random_welcome([string tolower $channel]) [lreplace $random_welcome([string tolower $channel]) $i $i]

     putlog "Writing welcomes file..."
     welcome_write
     
     return 1
  } {
     putserv "PRIVMSG $nick :That number is out of range!"
     return 0
  }
}

proc welcome_erase_dcc {hand idx arg} {
  global random_welcome 


  set channel [lindex $arg 1]

  if {$channel == ""} {
     putidx $idx "Usage: welcome DEL <channel> <welcome#>"
     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_welcome([string tolower $channel])]} {
     putidx $idx "No welcomes set."
     return 0
  }

  set i [expr [lindex $arg 2] - 1]
  if {$i >=0 && [lindex $random_welcome([string tolower $channel]) $i] != ""} {
     putidx $idx "Entry [lindex $arg 2] erased."
     putidx $idx "$channel [lindex $random_welcome([string tolower $channel]) $i]"
     set random_welcome([string tolower $channel]) [lreplace $random_welcome([string tolower $channel]) $i $i]

     putlog "Writing welcomes file..."
     welcome_write
     
     return 1
  } {
     putidx $idx "That number is out of range!"
     return 0
  }
}

proc welcome_help_pub {nick uhost hand channel arg} {

    putserv "PRIVMSG $nick :Usage: welcome                  - show welcomes"
    putserv "PRIVMSG $nick :       welcome ADD <new welcome>  - add welcome entry"
    putserv "PRIVMSG $nick :       welcome DEL <welcome#>     - delete welcome entry"
    putserv "PRIVMSG $nick :       welcome SET <welcome>      - set a welcome for a channel (no randomize)"
    putserv "PRIVMSG $nick :       welcome SET  OFF         - set randomize on"
    return 1
}

proc welcome_help {nick uhost hand arg} {

    putserv "PRIVMSG $nick :Usage: welcome                            - show welcomes"
    putserv "PRIVMSG $nick :       welcome ADD <channel> <new welcome>  - add welcome entry"
    putserv "PRIVMSG $nick :       welcome DEL <channel> <welcome#>     - delete welcome entry"
    putserv "PRIVMSG $nick :       welcome SET <channel> <welcome>      - set a welcome for a channel (no randomize)"
    putserv "PRIVMSG $nick :       welcome SET <channel> OFF          - set randomize on"
    return 1
}

proc welcome_help_dcc {hand idx arg} {

    putidx $idx "Usage: welcome                            - show welcomes"
    putidx $idx "       welcome ADD <channel> <new welcome>  - add welcome entry"
    putidx $idx "       welcome DEL <channel> <welcome#>     - delete welcome entry"
    putidx $idx "       welcome SET <channel> <welcome>      - set a welcome for a channel (no randomize)"
    putidx $idx "       welcome SET <channel> OFF          - set randomize on"
    return 1
}

proc welcome_load {} {
   global random_welcome setwelcome welcomefile welcomesetfile

   if {[info exists random_welcome]} {unset random_welcome}
   if {[catch {set fd [open $welcomefile 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_welcome([string tolower $channel]) [lrange $inp 1 end]
   }
   close $fd

   if {[info exists setwelcome]} {unset setwelcome}
   if {[catch {set fd [open $welcomesetfile 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 setwelcome([string tolower $channel]) [lrange $inp 1 end]
   }
   close $fd



   return 1
}

proc welcome_write {} {
   global welcomefile random_welcome setwelcome welcomesetfile

   set fd [open $welcomefile w]
   foreach channel [array names random_welcome] {
      if {[lsearch -exact [string tolower [channels]] [string tolower $channel]] != -1} {
         if {[lindex $random_welcome([string tolower $channel]) 0] != ""} {
            foreach i $random_welcome([string tolower $channel]) {
               puts $fd "$channel $i"
            }
         }
      }
   }
   close $fd

   set fd [open $welcomesetfile w]
   foreach channel [array names setwelcome] {
      if {[lsearch -exact [string tolower [channels]] [string tolower $channel]] != -1} {
         if {[lindex $setwelcome([string tolower $channel]) 0] != ""} {
            set i $setwelcome([string tolower $channel]) 
               puts $fd "$channel $i"
         }
      }
   }
   close $fd

   return 1
}


proc msg_welcome {nick uhost hand arg} {
  switch [string tolower [lindex $arg 0]] {
    "add"       {set r [welcome_add $nick $uhost $hand $arg]}
    "del"       {set r [welcome_erase $nick $uhost $hand $arg]}
    "delete"    {set r [welcome_erase $nick $uhost $hand $arg]}
    "set"       {set r [welcome_set $nick $uhost $hand $arg]}
    "help"      {set r [welcome_help $nick $uhost $hand $arg]}
    default     {set r [welcome_show $nick $uhost $hand $arg]}
  }
  return $r
}

proc pub_welcome {nick uhost hand channel arg} {
  switch [string tolower [lindex $arg 0]] {
    "add"       {set r [welcome_add_pub $nick $uhost $hand $channel $arg]}
    "del"       {set r [welcome_erase_pub $nick $uhost $hand $channel $arg]}
    "delete"    {set r [welcome_erase_pub $nick $uhost $hand $channel $arg]}
    "set"       {set r [welcome_set_pub $nick $uhost $hand $channel $arg]}
    "help"      {set r [welcome_help_pub $nick $uhost $hand $channel $arg]}
    default     {set r [welcome_show_pub $nick $uhost $hand $channel $arg]}
  }
  return $r
}


proc dcc_welcome {hand idx arg} {
  switch [string tolower [lindex $arg 0]] {
    "add"       {set r [welcome_add_dcc $hand $idx $arg]}
    "del"       {set r [welcome_erase_dcc $hand $idx $arg]}
    "delete"    {set r [welcome_erase_dcc $hand $idx $arg]}
    "set"       {set r [welcome_set_dcc $hand $idx $arg]}
    "help"      {set r [welcome_help_dcc $hand $idx $arg]}
    default     {set r [welcome_show_dcc $hand $idx $arg]}
  }
  return $r
}


welcome_load

if {![info exists set_welcome_running] && ![info exists random_welcome] && ![info exists setwelcome]} {
  set set_welcome_running 1
}Am incercat sa inlocuiesc JOIN cu PART si WELCOME cu LEAVE , dar imi da urma
Am incercat sa inlocuiesc JOIN cu PART si WELCOME cu LEAVE , dar imi da urmatoarea eroare:

Code:
Tcl error [set_leave]: wrong # args: should be "set_leave nick uhost hand chan"
Sursa TCL cu Welcome este MultiGreet facut de Creative1 !

As vrea sa stiu si eu de unde pot face rost de TCL cu Ban-Reason si Kick-Reason.Daca se poate as vrea sa se setez astfel:

Ban-Reason: !chanset #canal ban-reason <msg>
Kick-Reason: !chanset #canal kick-reason <msg>

P.S: Sorry Universalia daca am gresit cu ceva , dar nu a fost cu intentie ! Ms de intelegere ! Bafta !
SoLLo is offline   Reply With Quote
Old 10-04-2007, 15:52   #2 (permalink)
Junior Member
 
KShadow's Avatar
 
Join Date: Sep 2006
Age: 19
Posts: 21
Rep Power: 0
KShadow is an unknown quantity at this point
Send a message via AIM to KShadow Send a message via Yahoo to KShadow
Default

Code:
if {![info exists welcomefile]} {
   set welcomefile "welcomefile"
   set welcomesetfile "welcomeset"
}

bind pub - !welcome pub_welcome
bind pub - `welcome pub_welcome
bind pub - .welcome pub_welcome
bind join - *!*@* set_welcome
bind msg - welcome welcome_set
bind dcc - welcome welcome_set_dcc


proc welcome:replace { nick chan line } {
  global botnick
  if {[string match "*%nick%*" $line]} { regsub -all %nick% $line $nick line }
  if {[string match "*%chan%*" $line]} { regsub -all %chan% $line $chan line }
  return $line
}


proc set_welcome {nick uhost hand chan} {
  global random_welcome setwelcome botnick welcome:replace

 if {$botnick != $nick} {
  if [channel get $chan welcome] {
  if {[info exists setwelcome([string tolower $chan])] && [lindex $setwelcome([string tolower $chan]) 0] != ""} {
    set i $setwelcome([string tolower $chan]) 
    puthelp "PRIVMSG $nick :[welcome:replace $nick $chan $i]"

   } {

     foreach i [array names random_welcome] {
        if {[lsearch -exact [string tolower [channels]] [string tolower $i]] != -1} {
            if {[lindex $random_welcome([string tolower $i]) 0] != ""} {
              set welcome [lindex $random_welcome($i) [rand [llength $random_welcome($i)]]]
                if {$chan == $i} {
                  puthelp "PRIVMSG $nick :$welcome
                }
            }
}
        } {
            unset random_welcome($i)
          }
      }
   }
 }
}

proc welcome_show_pub {nick uhost hand channel arg} {
  global random_welcome setwelcome botnick 


  if {![matchattr $hand m|m $channel]} {
     putserv "PRIVMSG $channel :Sorry, you are not authorized to use this command."
     return 0
  }

  if {[info exists setwelcome([string tolower $channel])] && [lindex $setwelcome([string tolower $channel]) 0] != ""} {
    set i $setwelcome([string tolower $channel]) 
       putserv "PRIVMSG $channel :\002welcome Set to:\002  $i"
       putserv "PRIVMSG $channel :Use welcome SET $channel OFF if you want to turn it off."
   
    }
    putserv "PRIVMSG $channel :Type \002/msg $botnick welcome HELP\002 for help."

  return 1
}


proc welcome_show {nick uhost hand arg} {
  global random_welcome setwelcome botnick 

  set channel [lindex $arg 0]
  if {$channel == ""} {
     putserv "PRIVMSG $nick :Usage: welcome <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
  }

  if {[info exists setwelcome([string tolower $channel])] && [lindex $setwelcome([string tolower $channel]) 0] != ""} {
    set i $setwelcome([string tolower $channel]) 
       putserv "PRIVMSG $nick :\002welcome Set to:\002  $i"
       putserv "PRIVMSG $nick :Use welcome SET $channel OFF if you want to turn it off."
   
    }
  

  putserv "PRIVMSG $nick :Type \002/msg $botnick welcome HELP\002 for help."

  return 1
}

proc welcome_show_dcc {hand idx arg} {
  global random_welcome setwelcome botnick 

  set channel [lindex $arg 0]
  if {$channel == ""} {
     putidx $idx "Usage: welcome <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 "welcomes for \002$channel\002:"

  if {[info exists setwelcome([string tolower $channel])] && [lindex $setwelcome([string tolower $channel]) 0] != ""} {
    set i $setwelcome([string tolower $channel]) 
       putidx $idx "\002welcome Set to:\002  $i"
       putidx $idx "Use welcome SET $channel OFF if you want to turn it off."
       }


 
  putidx $idx "Type \002.welcome HELP\002 for help."

  return 1
}

proc welcome_set_pub {nick uhost hand channel arg} {
  global setwelcome

  if {![matchattr $hand m|m $channel]} {
     putserv "PRIVMSG $channel :Sorry, you are not authorized to use this command."
     return 0
  }
  if {[string tolower [lindex $arg 1]] != "-off"} {
    putserv "PRIVMSG $channel :welcome set to: [lrange $arg 1 end]"
    set setwelcome([string tolower $channel]) [lrange $arg 1 end]
  } {
    putserv "PRIVMSG $channel :welcome set off $channel"
    set setwelcome([string tolower $channel]) [lrange "" 1 end]
  }
  
  putlog "Writing welcomes file..."
  welcome_write
  
  return 1

}


proc welcome_set {nick uhost hand arg} {
  global setwelcome

  set channel [lindex $arg 1]

  if {$channel == ""} {
     putserv "PRIVMSG $nick :Usage: welcome SET <channel> <welcome>"
     putserv "PRIVMSG $nick :Or:    welcome 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 1]] != "-off"} {
    putserv "PRIVMSG $nick :welcome set to: [lrange $arg 1 end]"
    set setwelcome([string tolower $channel]) [lrange $arg 1 end]
  } {
    putserv "PRIVMSG $nick :welcome set off $channel"
    set setwelcome([string tolower $channel]) [lrange "" 1 end]
  }
  
  putlog "Writing welcomes file..."
  welcome_write
  
  return 1

}

proc welcome_set_dcc {hand idx arg} {
  global setwelcome

  set channel [lindex $arg 2]

  if {$channel == ""} {
     putidx $idx "Usage: welcome SET <channel> <welcome>"
     putidx $idx "Or:    welcome 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 "welcome set to: [lrange $arg 1 end]"
    set setwelcome([string tolower $channel]) [lrange $arg 2 end]
  } {
    putidx $idx "welcome set off $channel"
    set setwelcome([string tolower $channel]) [lrange "" 2 end]
  }
  
  
  putlog "Writing welcomes file..."
  welcome_write
  
  return 1

}
proc welcome_load {} {
   global random_welcome setwelcome welcomefile welcomesetfile

   if {[info exists random_welcome]} {unset random_welcome}
   if {[catch {set fd [open $welcomefile 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_welcome([string tolower $channel]) [lrange $inp 1 end]
   }
   close $fd

   if {[info exists setwelcome]} {unset setwelcome}
   if {[catch {set fd [open $welcomesetfile 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 setwelcome([string tolower $channel]) [lrange $inp 1 end]
   }
   close $fd



   return 1
}

proc welcome_write {} {
   global welcomefile random_welcome setwelcome welcomesetfile

   set fd [open $welcomefile w]
   foreach channel [array names random_welcome] {
      if {[lsearch -exact [string tolower [channels]] [string tolower $channel]] != -1} {
         if {[lindex $random_welcome([string tolower $channel]) 0] != ""} {
            foreach i $random_welcome([string tolower $channel]) {
               puts $fd "$channel $i"
            }
         }
      }
   }
   close $fd

   set fd [open $welcomesetfile w]
   foreach channel [array names setwelcome] {
      if {[lsearch -exact [string tolower [channels]] [string tolower $channel]] != -1} {
         if {[lindex $setwelcome([string tolower $channel]) 0] != ""} {
            set i $setwelcome([string tolower $channel]) 
               puts $fd "$channel $i"
         }
      }
   }
   close $fd

   return 1
}


proc msg_welcome {nick uhost hand arg} {
  switch [string tolower [lindex $arg 0]] {
    "set"       {set r [welcome_set $nick $uhost $hand $arg]}
    "help"      {set r [welcome_help $nick $uhost $hand $arg]}
    default     {set r [welcome_show $nick $uhost $hand $arg]}
  }
  return $r
}

proc pub_welcome {nick uhost hand channel arg} {
  switch [string tolower [lindex $arg 0]] {
    "set"       {set r [welcome_set_pub $nick $uhost $hand $channel $arg]}
    "help"      {set r [welcome_help_pub $nick $uhost $hand $channel $arg]}
    default     {set r [welcome_show_pub $nick $uhost $hand $channel $arg]}
  }
  return $r
}


proc dcc_welcome {hand idx arg} {
  switch [string tolower [lindex $arg 0]] {
    "set"       {set r [welcome_set_dcc $hand $idx $arg]}
    "help"      {set r [welcome_help_dcc $hand $idx $arg]}
    default     {set r [welcome_show_dcc $hand $idx $arg]}
  }
  return $r
}


welcome_load

if {![info exists set_welcome_running] && ![info exists random_welcome] && ![info exists setwelcome]} {
  set set_welcome_running 1
}
Asta este de welcome.

PS: Universalia ce vrea el, este in arhiva #U&U, si nu exista copyright pt asta, deoarece e pus pe forumul botlending si modificata de mine ( scriptul de greet al lu arcade )
__________________
Ombladon Rulez !!
KShadow is offline   Reply With Quote
Old 10-04-2007, 15:54   #3 (permalink)
Junior Member
 
KShadow's Avatar
 
Join Date: Sep 2006
Age: 19
Posts: 21
Rep Power: 0
KShadow is an unknown quantity at this point
Send a message via AIM to KShadow Send a message via Yahoo to KShadow
Default

Code:
if {![info exists leavefile]} {
   set leavefile "leavefile"
   set leavesetfile "leaveset"
}

bind pub - !leave pub_leave
bind pub - `leave pub_leave
bind pub - .leave pub_leave
bind part - *!*@* set_leave
bind msg - leave leave_set
bind dcc - leave leave_set_dcc


proc leave:replace { nick chan line } {
  global botnick
  if {[string match "*%nick%*" $line]} { regsub -all %nick% $line $nick line }
  if {[string match "*%chan%*" $line]} { regsub -all %chan% $line $chan line }
  return $line
}


proc set_leave {nick uhost hand chan text} {
  global random_leave setleave botnick leave:replace

 if {$botnick != $nick} {
  if [channel get $chan leave] {
  if {[info exists setleave([string tolower $chan])] && [lindex $setleave([string tolower $chan]) 0] != ""} {
    set i $setleave([string tolower $chan]) 
    puthelp "PRIVMSG $nick :[leave:replace $nick $chan $i]"

   } {

     foreach i [array names random_leave] {
        if {[lsearch -exact [string tolower [channels]] [string tolower $i]] != -1} {
            if {[lindex $random_leave([string tolower $i]) 0] != ""} {
              set leave [lindex $random_leave($i) [rand [llength $random_leave($i)]]]
                if {$chan == $i} {
                  puthelp "PRIVMSG $nick :$leave
                }
            }
}
        } {
            unset random_leave($i)
          }
      }
   }
 }
}

proc leave_show_pub {nick uhost hand channel arg} {
  global random_leave setleave botnick 


  if {![matchattr $hand m|m $channel]} {
     putserv "PRIVMSG $channel :Sorry, you are not authorized to use this command."
     return 0
  }

  if {[info exists setleave([string tolower $channel])] && [lindex $setleave([string tolower $channel]) 0] != ""} {
    set i $setleave([string tolower $channel]) 
       putserv "PRIVMSG $channel :\002leave Set to:\002  $i"
       putserv "PRIVMSG $channel :Use leave SET $channel OFF if you want to turn it off."
   
    }
    putserv "PRIVMSG $channel :Type \002/msg $botnick leave HELP\002 for help."

  return 1
}


proc leave_show {nick uhost hand arg} {
  global random_leave setleave botnick 

  set channel [lindex $arg 0]
  if {$channel == ""} {
     putserv "PRIVMSG $nick :Usage: leave <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
  }

  if {[info exists setleave([string tolower $channel])] && [lindex $setleave([string tolower $channel]) 0] != ""} {
    set i $setleave([string tolower $channel]) 
       putserv "PRIVMSG $nick :\002leave Set to:\002  $i"
       putserv "PRIVMSG $nick :Use leave SET $channel OFF if you want to turn it off."
   
    }
  

  putserv "PRIVMSG $nick :Type \002/msg $botnick leave HELP\002 for help."

  return 1
}

proc leave_show_dcc {hand idx arg} {
  global random_leave setleave botnick 

  set channel [lindex $arg 0]
  if {$channel == ""} {
     putidx $idx "Usage: leave <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 "leaves for \002$channel\002:"

  if {[info exists setleave([string tolower $channel])] && [lindex $setleave([string tolower $channel]) 0] != ""} {
    set i $setleave([string tolower $channel]) 
       putidx $idx "\002leave Set to:\002  $i"
       putidx $idx "Use leave SET $channel OFF if you want to turn it off."
       }


 
  putidx $idx "Type \002.leave HELP\002 for help."

  return 1
}

proc leave_set_pub {nick uhost hand channel arg} {
  global setleave

  if {![matchattr $hand m|m $channel]} {
     putserv "PRIVMSG $channel :Sorry, you are not authorized to use this command."
     return 0
  }
  if {[string tolower [lindex $arg 1]] != "-off"} {
    putserv "PRIVMSG $channel :leave set to: [lrange $arg 1 end]"
    set setleave([string tolower $channel]) [lrange $arg 1 end]
  } {
    putserv "PRIVMSG $channel :leave set off $channel"
    set setleave([string tolower $channel]) [lrange "" 1 end]
  }
  
  putlog "Writing leaves file..."
  leave_write
  
  return 1

}


proc leave_set {nick uhost hand arg} {
  global setleave

  set channel [lindex $arg 1]

  if {$channel == ""} {
     putserv "PRIVMSG $nick :Usage: leave SET <channel> <leave>"
     putserv "PRIVMSG $nick :Or:    leave 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 1]] != "-off"} {
    putserv "PRIVMSG $nick :leave set to: [lrange $arg 1 end]"
    set setleave([string tolower $channel]) [lrange $arg 1 end]
  } {
    putserv "PRIVMSG $nick :leave set off $channel"
    set setleave([string tolower $channel]) [lrange "" 1 end]
  }
  
  putlog "Writing leaves file..."
  leave_write
  
  return 1

}

proc leave_set_dcc {hand idx arg} {
  global setleave

  set channel [lindex $arg 2]

  if {$channel == ""} {
     putidx $idx "Usage: leave SET <channel> <leave>"
     putidx $idx "Or:    leave 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 "leave set to: [lrange $arg 1 end]"
    set setleave([string tolower $channel]) [lrange $arg 2 end]
  } {
    putidx $idx "leave set off $channel"
    set setleave([string tolower $channel]) [lrange "" 2 end]
  }
  
  
  putlog "Writing leaves file..."
  leave_write
  
  return 1

}
proc leave_load {} {
   global random_leave setleave leavefile leavesetfile

   if {[info exists random_leave]} {unset random_leave}
   if {[catch {set fd [open $leavefile 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_leave([string tolower $channel]) [lrange $inp 1 end]
   }
   close $fd

   if {[info exists setleave]} {unset setleave}
   if {[catch {set fd [open $leavesetfile 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 setleave([string tolower $channel]) [lrange $inp 1 end]
   }
   close $fd



   return 1
}

proc leave_write {} {
   global leavefile random_leave setleave leavesetfile

   set fd [open $leavefile w]
   foreach channel [array names random_leave] {
      if {[lsearch -exact [string tolower [channels]] [string tolower $channel]] != -1} {
         if {[lindex $random_leave([string tolower $channel]) 0] != ""} {
            foreach i $random_leave([string tolower $channel]) {
               puts $fd "$channel $i"
            }
         }
      }
   }
   close $fd

   set fd [open $leavesetfile w]
   foreach channel [array names setleave] {
      if {[lsearch -exact [string tolower [channels]] [string tolower $channel]] != -1} {
         if {[lindex $setleave([string tolower $channel]) 0] != ""} {
            set i $setleave([string tolower $channel]) 
               puts $fd "$channel $i"
         }
      }
   }
   close $fd

   return 1
}


proc msg_leave {nick uhost hand arg} {
  switch [string tolower [lindex $arg 0]] {
    "set"       {set r [leave_set $nick $uhost $hand $arg]}
    "help"      {set r [leave_help $nick $uhost $hand $arg]}
    default     {set r [leave_show $nick $uhost $hand $arg]}
  }
  return $r
}

proc pub_leave {nick uhost hand channel arg} {
  switch [string tolower [lindex $arg 0]] {
    "set"       {set r [leave_set_pub $nick $uhost $hand $channel $arg]}
    "help"      {set r [leave_help_pub $nick $uhost $hand $channel $arg]}
    default     {set r [leave_show_pub $nick $uhost $hand $channel $arg]}
  }
  return $r
}


proc dcc_leave {hand idx arg} {
  switch [string tolower [lindex $arg 0]] {
    "set"       {set r [leave_set_dcc $hand $idx $arg]}
    "help"      {set r [leave_help_dcc $hand $idx $arg]}
    default     {set r [leave_show_dcc $hand $idx $arg]}
  }
  return $r
}


leave_load

if {![info exists set_leave_running] && ![info exists random_leave] && ![info exists setleave]} {
  set set_leave_running 1
}
Si asta este de leave ( same copyright @ arcade / forum #botlending ) Pe arhiva mea de la u&u merg perfect, daca iti da vreo eroare revii si tu cu reply
__________________
Ombladon Rulez !!
KShadow is offline   Reply With Quote
Old 12-04-2007, 14:31   #4 (permalink)
TCB & Ratings projects Member, #Mythic representative
 
arcade's Avatar
 
Join Date: Jun 2004
Location: In fatza calculatorului!!
Age: 19
Posts: 221
Rep Power: 37
arcade is on a distinguished road
Send a message via Yahoo to arcade
Default

ban-reason si kick-reason nu este public. Dar poti incerca sa faci tu ceva si noi te vom ghida in directia corecta.

O sa iti dau niste sfaturi de inceput:
- avand in vedere ca suntem in Tcl Scripting iti sugerez fie sa faci un array global cu reasonurile de kick, fie sa folosesti un str in care sa setezi ban-reason.
- dupa ce ai ales una din variantele de mai sus, reasonurile tale trebuie incluse in procesele de kick respectiv ban astfel:
1. in caz ca ai folosit str:
Code:
if { $reason == "" } { set reason [channel get $chan ban-reason] }
idem pt kick-reason

2. in caz ca ai folosit un array global (de exemplu reason(#chan,kick) respectiv reason(#chan,ban) ) vei proceda astfel:
Code:
global reason #aici definesti reason ca global
if { $reason == "" } { set reason $reason($chan,ban) }
idem pt kick

Sper ca suggestiile mele te vor ajuta, astept sa vad ce ai lucrat pt a te ghida in directia correcta.
__________________
Fuck oFF!
arcade is offline   Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
[Correct script] Eroare Botnet [Welcome,Leave,Greet] SoLLo Tcl scripting 1 24-05-2007 19:07
*HELP* - .ban <nick/*!*@host> [XdXhXm] [reason] edu Tcl scripting 3 03-09-2006 13:04
extrage userul cand se da kick Kurupt Tcl scripting 1 18-08-2004 21:16
Kick/Ban in care apare handle/nick Kurupt Tcl scripting 7 18-06-2004 09:29


All times are GMT +3. The time now is 13:52.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.