This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

botnick

Old posts that have not been replied to for several years.
Locked
User avatar
Kurupt
Voice
Posts: 26
Joined: Sun Aug 22, 2004 7:57 pm
Location: Hermanstat

botnick

Post by Kurupt »

somebody helped me and with his colaboration i got that source

Code: Select all


bind nick -|- * nick:change 
 
proc nick:change {nick uhost hand chan newnick} {
 
   if {[isbotnick $nick]} {
	 foreach bind [binds $nick] {
		 set type [lindex $bind 0]
		 set flag [lindex $bind 1]
		 set mask [lindex $bind 2]
		 set proc [lindex $bind 4]
 
		 regsub -- $nick $mask $newnick newmask 
 
		 unbind $type $flag $mask $proc
		 bind $type $flag $newmask $proc
	 }
   }
}
 
bind evnt - init-server connect:irc
 
proc connect:irc {type} {
   global botnick settings
 
   set cmdpfix [lindex [split $settings(binds)] 0]
 
   foreach bind [binds ${cmdpfix}*] {
	  
	  set cmd [string trimleft [lindex $bind 2] $cmdpfix]
	  bind pubm [lindex $bind 1] "% $botnick~${cmd}*" [lindex $bind 4]
   }
}

That script works afther restart but if the botnick changed i need a new restart for working with the new nick.So maybe sombody got a ideea to modify the script or got a bether script i am realy interesed. thanks
User avatar
awyeah
Revered One
Posts: 1580
Joined: Mon Apr 26, 2004 2:37 am
Location: Switzerland
Contact:

Post by awyeah »

Check this thread to see how to bind for botnick change outside a channel, because when you connect on init-server the bot is on no channel at that moment, it eventually takes time to join all the channels added in its .chan file. :P

http://forum.egghelp.org/viewtopic.php?t=8274
·­awyeah·

==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
==================================
User avatar
YooHoo
Owner
Posts: 939
Joined: Thu Feb 13, 2003 10:07 pm
Location: Redwood Coast

Post by YooHoo »

This is the script I use, available at the tcl archives:

Code: Select all

# botnick.tcl v1.0 (21 November 1999)
# copyright  1999 by slennox <slennox@egghelp.org>
# slennox's eggdrop page - http://www.egghelp.org/
#
# This script adds a little feature that lots of people ask for - a DCC
# command (for global +n users) that changes the bot's nickname.
#
# Usage: botnick <newnick>
#
# Additional Features
# * You can use question marks in the newnick and the bot will substitute
#   random numbers, e.g. '.botnick harry??' would create a nick like
#   'harry53'.
# * You can use '.botnick -altnick' to make the bot switch to its alternate
#   nickname.


# Don't edit below unless you know what you're doing.

proc bn_dccbotnick {hand idx arg} {
  global altnick nick
  putcmdlog "#$hand# botnick $arg"
  set newnick [lindex [split $arg] 0]
  if {$newnick == ""} {
    putidx $idx "Usage: botnick <newnick>"
    return 0
  }
  if {$newnick == "-altnick"} {
    set newnick $altnick
  }
  while {[regsub -- \\? $newnick [rand 10] newnick]} {continue}
  putidx $idx "Changing nick to '$newnick'..."
  set nick $newnick
  return 0
}

bind dcc n botnick bn_dccbotnick

putlog "Loaded botnick.tcl v1.0 by slennox"

return
It works perfectly, although the version I have is altered slightly, so there is a switch to return to original nick (.botnick -true), and to do so after a certain period of time if not returned. Hope this helps :mrgreen:
User avatar
awyeah
Revered One
Posts: 1580
Joined: Mon Apr 26, 2004 2:37 am
Location: Switzerland
Contact:

Post by awyeah »

This is for changing the bots nick in dcc (partyline). The script which I recommended detects if the bot changes its nick, then does what ever you want it to do. :)
·­awyeah·

==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
==================================
User avatar
Kurupt
Voice
Posts: 26
Joined: Sun Aug 22, 2004 7:57 pm
Location: Hermanstat

this

Post by Kurupt »

No error but still not works

Code: Select all

bind raw - NICK rawNick
proc rawNick {f k a} {
  if {$f==$::botname} {
  # new botnick is [string range $a 1 end]
    foreach bind [binds $nick] {
      set type [lindex $bind 0]
      set flag [lindex $bind 1]
      set mask [lindex $bind 2]
      set proc [lindex $bind 4]

      regsub -- $nick $mask $newnick newmask

      unbind $type $flag $mask $proc
      bind $type $flag $newmask $proc
    }
  }
}
bind evnt - init-server connect:irc

proc connect:irc {type} {
  global botnick settings

  set cmdpfix [lindex [split $settings(binds)] 0]

  foreach bind [binds ${cmdpfix}*] {

    set cmd [string trimleft [lindex $bind 2] $cmdpfix]
    bind pubm [lindex $bind 1] "% $botnick~${cmd}*" [lindex $bind 4]
  }
}
bind pub - .uptime uptime
proc uptime {nick uhost hand chan args} {
  global uptime {server-online};
  if {[catch {exec uptime} server]} {set server "Windows/Server"}
  putserv "privmsg $chan :UPTIME: [duration [expr [unixtime] - $uptime]], ON-LINE [duration [expr [unixtime] - ${server-online}]], SERVER UPTIME $server "
}
Locked