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 help converting to a pushmode =\

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


Joined: 31 Jul 2006
Posts: 12

PostPosted: Sun Jul 01, 2007 3:04 am    Post subject: Need help converting to a pushmode =\ Reply with quote

qban { if ($1 ison $chan) { /mode # +b ~q: $+ $address($$1,2) } }
deqban { if ($1 ison $chan) { /mode # -b ~q: $+ $address($$1,2) } }

Cannot figure out how to get this to work in my bot
I have the rest of the script already written but this is stumping me
i thought like pushmode $chan +b ~q: $+ $host or something lol
pls help
Back to top
View user's profile Send private message MSN Messenger
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Sun Jul 01, 2007 8:12 am    Post subject: Reply with quote

doc/tcl-commands.doc wrote:
pushmode <channel> <mode> [arg]
Description: sends out a channel mode change (ex: pushmode #lame +o
goober) through the bot's queuing system. All the mode changes will
be sent out at once (combined into one line as much as possible) after
the script finishes, or when 'flushmode' is called.
Returns: nothing
Module: irc

So basically, to add the ban "*!*@badhost" on channel "#mychannel", you'd do something like this:
Code:
pushmode #mychannel +b "*!*@badhost"


Be aware that some of the ugly hacks in mirc-scripts are'nt nessecary (or available) in tcl (such as the "remove-space" token $+).
It would seem you're trying to add a ban such as this: "~q:*!*user@host", which would probably be something like this, depending on your code:
Code:
pushmode $channel +b "~q:*!*${host}"

_________________
NML_375, idling at #eggdrop@IrcNET
Back to top
View user's profile Send private message
BIF
Voice


Joined: 31 Jul 2006
Posts: 12

PostPosted: Mon Jul 02, 2007 12:51 am    Post subject: Ok thx I have figured it out and this is working Reply with quote

Code:

proc pub:sban {nick uhost hand chan txt} {
  set txt [split $txt]
  set who [lindex $txt 0]
  if {[isbotnick $who]} { return }
  append ban "~q:*!*@" [lindex [split [getchanhost $who $chan] "@"] 1]
  if {[llength $txt] > 1} {
    set reason [join [lrange $txt 1 "end"]]
  } else {
    set reason "Requested"
  }
  if {[isvoice $who $chan]} {
    pushmode $chan "-v" $who
  }
  pushmode $chan +b $ban 
  puthelp "NOTICE $who :You Have been Placed on Silent Ban For bad Behavior."
  flushmode $chan
  return 1
}
Back to top
View user's profile Send private message MSN Messenger
BIF
Voice


Joined: 31 Jul 2006
Posts: 12

PostPosted: Mon Jul 02, 2007 12:52 am    Post subject: Reply with quote

However When you just type !sban without any nick it will set +b ~q:*!*@* anyway i can stop that from happening.. Like make it not do anything if no nick is supplied ?
Back to top
View user's profile Send private message MSN Messenger
speechles
Revered One


Joined: 26 Aug 2006
Posts: 1398
Location: emerald triangle, california (coastal redwoods)

PostPosted: Mon Jul 02, 2007 1:34 am    Post subject: Reply with quote

BIF wrote:
However When you just type !sban without any nick it will set +b ~q:*!*@* anyway i can stop that from happening.. Like make it not do anything if no nick is supplied ?
Code:
change this:
if {[isbotnick $who]} { return }

to this:
if {$who == "" || [isbotnick $who]} { return }
Back to top
View user's profile Send private message
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Mon Jul 02, 2007 8:58 am    Post subject: Reply with quote

I'd rather suggest replacing that line with this:
Code:
if {[isbotnick $who] || ![onchan $who $chan]} {return}

Checks wether the specified nick is present on the current channel, and aborts if not.
_________________
NML_375, idling at #eggdrop@IrcNET
Back to top
View user's profile Send private message
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