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.

[SOLVED] Script allows Bot to Kick and Ban Itself: Help!

Help for those learning Tcl or writing their own scripts.
Post Reply
a
achilles1900
Voice
Posts: 30
Joined: Mon Apr 21, 2008 5:40 am

[SOLVED] Script allows Bot to Kick and Ban Itself: Help!

Post by achilles1900 »

Hi Forum people,

I have a public command script for users with +o in the bot.
Problem is when executing !kick (botnick) & !ban (botnick); the bot kicks and bans itself.

Can someone please go through it and see where the error is? I thank you in advance, cause' it would really help our channel.

Best regards. (script follows)

Code: Select all

# Process Kick
proc proc_kick { nick uhost hand chan text } {
 global botnick
  if {[onchan $text]} {
  if {$text != $botnick} {
    putquick "KICK $chan $text :Requested"
}
  } else { putserv "PRIVMSG $chan :\002$text\002 Not In Channel: \002$chan\002" }
}

# Ban Process
proc proc_ban { nick uhost hand chan text } {
  global botnick
  if {[onchan $text]} {
    if {$text == $botnick} { return 0 }
    set banmask [maskhost [getchanhost $text $chan]]
    putquick "MODE $chan +b $banmask"
    putkick $chan $text :Requested
  } else { putserv "PRIVMSG $chan :$text Is Not In The Channel" }
}
Last edited by achilles1900 on Wed Dec 10, 2008 12:17 pm, edited 1 time in total.
User avatar
user
 
Posts: 1452
Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway

Post by user »

I guess the problem is case sensitive nick matching. Change {$text != $botnick} to {![isbotnick $text]}
Have you ever read "The Manual"?
a
achilles1900
Voice
Posts: 30
Joined: Mon Apr 21, 2008 5:40 am

Thanks! The !kick Part is solved but

Post by achilles1900 »

Hi User,

thanks man, your expert advice solved the !kick part. That works like a charm!

However the !ban part is still banning even though I replaced:

if {$text == $botnick} { return 0 }

with

if {![isbotnick $text]} {

That killed the bot from shell with this error:

Tcl error in file 'bot.conf':
missing close-brace
while executing
"proc proc_ban { nick uhost hand chan text } {
global botnick
if {[onchan $text]} {
if {![isbotnick $text]} {
set banmask [maskhost [getcha..."
(file "scripts/opcmds.tcl" line 70)
invoked from within
* CONFIG FILE NOT LOADED (NOT FOUND, OR ERROR)
-
DCC session closed

Any other information you need please let me know, i really appreciate you taking the effort :D - Achilles
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

Replace

Code: Select all

if {$text == $botnick} { return 0 }
with

Code: Select all

if {[isbotnick $text]} { return 0 }
a
achilles1900
Voice
Posts: 30
Joined: Mon Apr 21, 2008 5:40 am

Post by achilles1900 »

Hi Sir_Fz

thanks for the reply and the help. I just tried it out and it works like a charm! Great advice!

My deepest appreciation to User & to Sir_Fz, this really helped us out :D
/me dances a jig....you guys have a good one.

with much appreciation,
Achilles
Post Reply