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 

log user text to file?

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


Joined: 09 Dec 2014
Posts: 8

PostPosted: Tue Dec 09, 2014 11:38 am    Post subject: log user text to file? Reply with quote

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?
Back to top
View user's profile Send private message AIM Address
SpiKe^^
Owner


Joined: 12 May 2006
Posts: 792
Location: Tennessee, USA

PostPosted: Wed Dec 10, 2014 1:50 am    Post subject: Reply with quote

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
.
Back to top
View user's profile Send private message Visit poster's website
bero93
Voice


Joined: 09 Dec 2014
Posts: 8

PostPosted: Wed Dec 10, 2014 8:33 am    Post subject: Reply with quote

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

Code:
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
    }
Back to top
View user's profile Send private message AIM Address
SpiKe^^
Owner


Joined: 12 May 2006
Posts: 792
Location: Tennessee, USA

PostPosted: Wed Dec 10, 2014 3:22 pm    Post subject: Try this. Reply with quote

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:

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
.
Back to top
View user's profile Send private message Visit poster's website
bero93
Voice


Joined: 09 Dec 2014
Posts: 8

PostPosted: Wed Dec 10, 2014 3:36 pm    Post subject: Reply with quote

Thanks!
i'm sure the script is not bug free, it's just a beginning.
Back to top
View user's profile Send private message AIM Address
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