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.

OnDeop

Help for those learning Tcl or writing their own scripts.
Post Reply
d
dq
Voice
Posts: 32
Joined: Mon Apr 03, 2006 12:28 am

OnDeop

Post by dq »

Hey all,

I'm working with the abuse script that H@0 made, I was looking to make some additions to it like OnDeop and OnBan here's what I have so far..

I'm not 100% sure with the OnDeop or OnBan as I don't know the args or the bind to use =x

Code: Select all

#  abuse user report by H@0 ver 1.0.

  #  configuration

     #  variables

          set validchannel "#reportcentre"
          set abuselogfile "logs/abuse.log"

          if {![info exists validchannel]} {die "ERROR:Check back again in set validchannel settings.."}
          set arg.v "Abuse User Report"

     #  bindings

          bind KICK -   *                   abuse_kick
          bind NEED -   "* -o"              abuse_deop
          bind PUB  n   -history            abuse_report


     #  source (again DO NOT change anything if you are not 100% sure) 


     #  process kicked


proc abuse_kick {nick host handle chan who excuse} {
  global abuselogfile botnick validchannel
  if {$who != $botnick} {return 0}
    set data "Info: Kick $botnick by $nick from $chan with excuse ($excuse)"
  if {$abuselogfile != ""} {set r [open $abuselogfile a+]; puts $r "[strftime "%d %b %Y, %H:%M %z"]: $data"; close $r}
    putquick "privmsg $validchannel :Important: (Bot: $botnick) (Action: Kicked) (Channel: $chan) (Reason: $excuse) (User: $nick)"
return 0
}

     #  process deopped

proc abuse_deop {nick uhost handle chan arg} {
  global abuselogfile botnick validchannel
  if {$who != $botnick} {return 0}
    set data "Info: Deop $botnick by $nick in $chan"
  if {$abuselogfile != ""} {set r [open $abuselogfile a+]; puts $r "[strftime "%d %b %Y, %H:%M %z"]: $data"; close $r}
    putquick "privmsg $validchannel :Important: (Bot: $botnick) (Action: Deopped) (Channel: $chan) (User: $nick)"
return 0
}

     #  process report

proc abuse_report {nick host handle channel var} {
global abuselogfile botnick validchannel
set fd [open $abuselogfile r]
set abuselist { }
while {![eof $fd]} {
 set tmp [gets $fd]
 if {[eof $fd]} {break}
  set abuselist [lappend abuselist [string trim $tmp]]
 }
 close $fd
 if {[llength $abuselist] == 0} {
     putserv "privmsg $validchannel :Error: There is no history for $botnick."
      return 0
 }
 putserv "privmsg $validchannel :Log History for $botnick:"
 foreach tmp $abuselist {
   putserv "privmsg $validchannel :$tmp"
 }
putserv "privmsg $validchannel : End of Abuselist\n"
 return 0
}
User avatar
Alchera
Revered One
Posts: 3344
Joined: Mon Aug 11, 2003 12:42 pm
Location: Ballarat Victoria, Australia
Contact:

Post by Alchera »

You may find the IRC/2 Numeric List of some help.

You might also read up on "botisop" in tcl-commands.doc in your bots ~/doc folder.
Add [SOLVED] to the thread title if your issue has been.
Search | FAQ | RTM
Post Reply