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.

log user text to file?

Help for those learning Tcl or writing their own scripts.
Post Reply
b
bero93
Voice
Posts: 8
Joined: Tue Dec 09, 2014 11:29 am

log user text to file?

Post by bero93 »

Hi there, i have a 'bad word script' running
and i want to log the line the user sad to a textfile,
so it will look like something like this:

09-12-2014 [20:23:22] <Monkeyboy> uncle [censored]

is this possible?
User avatar
SpiKe^^
Owner
Posts: 831
Joined: Fri May 12, 2006 10:20 pm
Location: Tennessee, USA
Contact:

Post by SpiKe^^ »

Yes it is possible. The exact code required may vary slightly depending on the script used. Post the script here so we can see what you're working with.
SpiKe^^

Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
.
b
bero93
Voice
Posts: 8
Joined: Tue Dec 09, 2014 11:29 am

Post by bero93 »

thanks for reply.
The code is part Dutch, but should not be a problem.

Code: Select all

set Ban "Ban voor vloeken"

set flag1 Y
set flag2 E
set flag3 G

###The bad words add and remove as you please

 bind pubm - "hoer" badword
 bind pubm - "*blaat*" badword
 bind pubm - "*cock*" badword
 bind pubm - "*kut*" badword
 bind pubm - "kut" badword
 bind pubm - "gvd" badword
 bind pubm - "godverdomme" badword
 bind pubm - "*kanker*" badword
 bind pubm - "kanker" badword
 bind pubm - "heil" badword
 
proc badword {nick uhost hand chan rest} {
putlog "$nick $uhost $hand $chan $rest"
  global botnick ban-time Ban bword
    if {([ matchattr $hand f ])} {
      	putserv "PRIVMSG $chan :\001$nick is NIET meer welkom hier!\001"
        return 1
	} elseif {([matchattr $hand G])} {
          chattr $nick +dk
	  setuser $nick COMMENT "Permanente ban wegens vloeken."
          putserv "PRIVMSG $chan :$nick, je bent NIET meer welkom hier!..."
	  putserv "KICK $chan $nick :$Ban \[Perm\]"	
        return 1
	} elseif {([matchattr $hand E])} {
	  chattr $nick +G-E
	  putserv "PRIVMSG $chan :$nick, je hebt nu je kansen gehad. Je mag 24 uur afkoelen. Nog een keer vloeken? Dan ben je niet  meer welkom!."
          set banlamer [maskhost [getchanhost $nick $chan]]
          newban $banlamer Badword $Ban 1440  none
          setuser $nick COMMENT "3e keer vloeken, 24uur ban"
          return 1
	} elseif {([matchattr $hand Y])} {
	  chattr $nick +E-Y
	  putserv "PRIVMSG $chan :Dat is de 2e keer dat je vloekt, $nick. Je mag een uurtje afkoelen."
	  set banlamer [maskhost [getchanhost $nick $chan]]
          newban $banlamer Badword $Ban 10 none
          setuser $nick COMMENT "2x vloeken 60 min.ban"
          return 1
	} 
          adduser $nick [maskhost [getchanhost $nick $chan]]
          putserv "PRIVMSG $chan :\001ACTION Vloeken is niet toegestaan $nick! De volgende keer krijg je een van van een uur!\001"
          putserv "KICK $chan $nick :2e keer vloeken is een uur brommen"
          putserv "NOTICE $nick :Vloeken is niet toegestaan in $chan"
          putserv "NOTICE $nick :Nog een keer vloeken is een uur brommen"
          chattr $nick +Y
          setuser $nick PASS $bword 
          setuser $nick COMMENT "Eerste vloek overtreding"
          return 0
	 }
User avatar
SpiKe^^
Owner
Posts: 831
Joined: Fri May 12, 2006 10:20 pm
Location: Tennessee, USA
Contact:

Try this.

Post by SpiKe^^ »

This would be the bare minimum for logging all lines that trigger this process.
This patch does not address any of the existing errors/issues in the original code.

Code: Select all

set Ban "Ban voor vloeken"

set flag1 Y
set flag2 E
set flag3 G

###The bad words add and remove as you please

 bind pubm - "hoer" badword
 bind pubm - "*blaat*" badword
 bind pubm - "*cock*" badword
 bind pubm - "*kut*" badword
 bind pubm - "kut" badword
 bind pubm - "gvd" badword
 bind pubm - "godverdomme" badword
 bind pubm - "*kanker*" badword
 bind pubm - "kanker" badword
 bind pubm - "heil" badword
 
proc badword {nick uhost hand chan rest} {
  putlog "$nick $uhost $hand $chan $rest"
  global botnick ban-time Ban bword

  set open [open badword.log a] 
  puts $open "[strftime "%d-%m-%Y \[%T\]"] <$nick> $rest" 
  close $open 

  if {([ matchattr $hand f ])} {
    putserv "PRIVMSG $chan :\001$nick is NIET meer welkom hier!\001"
    return 1
  } elseif {([matchattr $hand G])} {
    chattr $nick +dk
    setuser $nick COMMENT "Permanente ban wegens vloeken."
    putserv "PRIVMSG $chan :$nick, je bent NIET meer welkom hier!..."
    putserv "KICK $chan $nick :$Ban \[Perm\]"	
    return 1
  } elseif {([matchattr $hand E])} {
    chattr $nick +G-E
    putserv "PRIVMSG $chan :$nick, je hebt nu je kansen gehad. Je mag 24 uur afkoelen. Nog een keer vloeken? Dan ben je niet  meer welkom!."
    set banlamer [maskhost [getchanhost $nick $chan]]
    newban $banlamer Badword $Ban 1440  none
    setuser $nick COMMENT "3e keer vloeken, 24uur ban"
    return 1
  } elseif {([matchattr $hand Y])} {
    chattr $nick +E-Y
    putserv "PRIVMSG $chan :Dat is de 2e keer dat je vloekt, $nick. Je mag een uurtje afkoelen."
    set banlamer [maskhost [getchanhost $nick $chan]]
    newban $banlamer Badword $Ban 10 none
    setuser $nick COMMENT "2x vloeken 60 min.ban"
    return 1
  } 

  adduser $nick [maskhost [getchanhost $nick $chan]]
  putserv "PRIVMSG $chan :\001ACTION Vloeken is niet toegestaan $nick! De volgende keer krijg je een van van een uur!\001"
  putserv "KICK $chan $nick :2e keer vloeken is een uur brommen"
  putserv "NOTICE $nick :Vloeken is niet toegestaan in $chan"
  putserv "NOTICE $nick :Nog een keer vloeken is een uur brommen"
  chattr $nick +Y
  setuser $nick PASS $bword 
  setuser $nick COMMENT "Eerste vloek overtreding"
  return 0
}

SpiKe^^

Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
.
b
bero93
Voice
Posts: 8
Joined: Tue Dec 09, 2014 11:29 am

Post by bero93 »

Thanks!
i'm sure the script is not bug free, it's just a beginning.
Post Reply