egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

need little help.

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
crux
Voice


Joined: 05 Jan 2007
Posts: 35
Location: Myanmar

PostPosted: Tue Jan 23, 2007 2:28 pm    Post subject: need little help. Reply with quote

Code:
#Make the bot KICK someone...

bind msg n|n .kick kick
proc kick {nick host handle channel testes} {
set who [lindex $testes 0]
set why [lrange $testes 1 end]
if {$who == ""} {
putserv "NOTICE $nick :Usage: .KICK <nick> <reason>"
return 1
}
putserv "KICK $who :$why"
putserv "NOTICE $nick :Done: KICKED $who with: $why"
return 1
}
#end of kick


this code doesn't work. I think I need sth.. please help me if you know..

thanks you.
_________________
Myanmar Chat Online
MCO Chat
Back to top
View user's profile Send private message Visit poster's website
r0t3n
Owner


Joined: 31 May 2005
Posts: 507
Location: UK

PostPosted: Tue Jan 23, 2007 3:12 pm    Post subject: Reply with quote

Try:

Code:
#Make the bot KICK someone...

bind msg n|n .kick kick
proc kick {nick host handle channel testes} {
set who [lindex $testes 0]
set why [lrange $testes 1 end]
if {$who == ""} {
  putserv "NOTICE $nick :Usage: .KICK <nick> <reason>"
} elseif {![onchan $who $channel]} {
  putserv "NOTICE $nick :$who not on $channel."
} else {
  if {$why == ""} {
    putserv "KICK $channel $who :Requested by $nick"
  } else {
    putserv "KICK $channel $who :$why"
  }
}
#end of kick


Not Tested
_________________
r0t3n @ #r0t3n @ Quakenet
Back to top
View user's profile Send private message MSN Messenger
crux
Voice


Joined: 05 Jan 2007
Posts: 35
Location: Myanmar

PostPosted: Tue Jan 23, 2007 3:31 pm    Post subject: Reply with quote

Thanks you much, I'll test..
_________________
Myanmar Chat Online
MCO Chat
Back to top
View user's profile Send private message Visit poster's website
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Tue Jan 23, 2007 3:35 pm    Post subject: Reply with quote

You might wanna keep in mind there's no "channel" argument on a msg-binding...
Also, please considder "splitting" strings into lists before using list-operations such as lindex, lrange, etc. Especially when it comes from an untrusted source (in this case, untrusted means anything that might generate an improper list-structure)
_________________
NML_375, idling at #eggdrop@IrcNET
Back to top
View user's profile Send private message
crux
Voice


Joined: 05 Jan 2007
Posts: 35
Location: Myanmar

PostPosted: Thu Jan 25, 2007 3:55 pm    Post subject: Reply with quote

Tosser^^ wrote:
Try:

Code:
#Make the bot KICK someone...

bind msg n|n .kick kick
proc kick {nick host handle channel testes} {
set who [lindex $testes 0]
set why [lrange $testes 1 end]
if {$who == ""} {
  putserv "NOTICE $nick :Usage: .KICK <nick> <reason>"
} elseif {![onchan $who $channel]} {
  putserv "NOTICE $nick :$who not on $channel."
} else {
  if {$why == ""} {
    putserv "KICK $channel $who :Requested by $nick"
  } else {
    putserv "KICK $channel $who :$why"
  }
}
#end of kick


Not Tested




donesn't work Sad

i got this error:

Code:
[20:55] Tcl error [kick]: wrong # args: should be "kick nick host handle channel testes"

_________________
Myanmar Chat Online
MCO Chat
Back to top
View user's profile Send private message Visit poster's website
Sir_Fz
Revered One


Joined: 27 Apr 2003
Posts: 3793
Location: Lebanon

PostPosted: Thu Jan 25, 2007 4:34 pm    Post subject: Reply with quote

nml375 wrote:
You might wanna keep in mind there's no "channel" argument on a msg-binding...
Also, please considder "splitting" strings into lists before using list-operations such as lindex, lrange, etc. Especially when it comes from an untrusted source (in this case, untrusted means anything that might generate an improper list-structure)

i.e.
Code:
bind msg n|n .kick kick

proc kick {nick host hand arg} {
 if {[scan $arg "%s %s" who chan] != 2} {
  puthelp "notice $nick :Usage: .kick <chan> <nick> \[reason\]"
  return 0
 }
 set why [join [lrange [split $arg] 2 end]]
 if {![onchan $who $chan]} {
  puthelp "NOTICE $nick :$who not on $chan."
 } {
  if {$why == ""} {
   putserv "KICK $chan $who :Requested by $nick"
  } {
   putserv "KICK $chan $who :$why"
  }
 }
}

_________________
Follow me on GitHub

- Opposing

Public Tcl scripts
Back to top
View user's profile Send private message Visit poster's website
crux
Voice


Joined: 05 Jan 2007
Posts: 35
Location: Myanmar

PostPosted: Thu Jan 25, 2007 6:56 pm    Post subject: Reply with quote

thanks you
it's working now Very Happy
_________________
Myanmar Chat Online
MCO Chat
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber