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.

Fake user tcl

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Post Reply
d
duarteper
Voice
Posts: 12
Joined: Thu Dec 06, 2012 10:55 pm

Fake user tcl

Post by duarteper »

Hello

its possible to make a script that shows bot privates mgs in a restricted and private channel, and answer bot privates msg by typing in channel with this cmd ex: !BotNick Nick hello

Thanks in advance
User avatar
tomekk
Master
Posts: 255
Joined: Fri Nov 28, 2008 11:35 am
Location: Oswiecim / Poland
Contact:

Post by tomekk »

Code: Select all

cmd ex: !BotNick Nick hello 
You want to use this command on this 'private' channel or?
d
duarteper
Voice
Posts: 12
Joined: Thu Dec 06, 2012 10:55 pm

Post by duarteper »

i wont use this comand in channel and see the bot private messages in channel as well
User avatar
tomekk
Master
Posts: 255
Joined: Fri Nov 28, 2008 11:35 am
Location: Oswiecim / Poland
Contact:

Post by tomekk »

Code: Select all

# Author: tomekk
# e-mail:  tomekk/@/tomekk/./org
# home page: http://tomekk.org/
#
# Version 0.1
#
# This file is Copyrighted under the GNU Public License.
# http://www.gnu.org/copyleft/gpl.html

set private_channel "#private"

##############################################################
bind pub - !forward forward_proc
bind msgm - "*" private_proc

proc private_proc { nick uhost hand arg } {
        global private_channel

        if {[botonchan $private_channel]} {
                putquick "PRIVMSG $private_channel :$nick -> $arg"
        }
}

proc forward_proc { nick uhost hand chan arg } {
        global private_channel

        set forward_arg [split $arg]
        set forward_to [lindex $forward_arg 0]
        set forward_msg [join [lrange $forward_arg 1 end]]

        if {$chan == $private_channel} {
                if {$forward_msg != ""} {
                        putquick "PRIVMSG $forward_to :$forward_msg"
                } {
                        putquick "PRIVMSG $chan :use: !forward <nick> <msg>"
                }
        }
}

putlog "eggforward.tcl ver 0.1 by tomekk loaded"
Try it.
'private_channel' is the channel with all private messages
use '!forward <nick> <msg>' on this channel to send the msg to the user

/tiny fix, please redownload the script/
d
duarteper
Voice
Posts: 12
Joined: Thu Dec 06, 2012 10:55 pm

thanks a lot tomekk

Post by duarteper »

works like a charm, very well

thanks so mutch tomekk for your great work

some day (some year) i will make tcl like you, i wish, lol
j
janii
Halfop
Posts: 41
Joined: Wed Aug 03, 2011 8:08 am

Post by janii »

hello tomek vry nice tcl i used it it was a jem i want to ask if u can add 2 things in it
first
whn ever i give /msg botnick auth pass
the bot show my pass in channel where everyone can see it
2nd
!forward janii hello
will pvt msg me
i want it one more feature tht whn i type
!forward #egghelp hey
it shall msg that in #egghelp hey
thanks in advance
User avatar
SpiKe^^
Owner
Posts: 831
Joined: Fri May 12, 2006 10:20 pm
Location: Tennessee, USA
Contact:

Post by SpiKe^^ »

janii wrote...
i want it one more feature tht whn i type
!forward #egghelp hey
it shall msg that in #egghelp hey
That should already be working in the script:)
SpiKe^^

Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
.
User avatar
SpiKe^^
Owner
Posts: 831
Joined: Fri May 12, 2006 10:20 pm
Location: Tennessee, USA
Contact:

Post by SpiKe^^ »

This should keep the bot from sending your password to the private channel when doing '/msg botnick auth pass' command...

Code: Select all

# Author: tomekk 
# e-mail:  tomekk/@/tomekk/./org 
# home page: http://tomekk.org/ 
# 
# Version 0.1 
# 
# This file is Copyrighted under the GNU Public License. 
# http://www.gnu.org/copyleft/gpl.html 

set private_channel "#private" 

# List things not to forward to the channel, one item per line:
# List commands like this:  op *
# list badwords like this:  * badword *  :or:  *badword*
set dont_forward {

  auth *
  ident *
  op *

}  ;## end of dont_forward setting ##

############################################################## 
bind pub - !forward forward_proc 
bind msgm - "*" private_proc 
set dont_forward [split [string trim $dont_forward] \n]

proc private_proc { nick uhost hand arg } { 
        global private_channel dont_forward

        foreach item $dont_forward {
          set item [string trim $item]
          if {[string match -nocase $item $arg]} {  return  }
        }

        if {[botonchan $private_channel]} { 
                puthelp "PRIVMSG $private_channel :$nick -> $arg" 
        } 
        return
} 

proc forward_proc { nick uhost hand chan arg } { 
        global private_channel 

        set forward_arg [split $arg] 
        set forward_to [lindex $forward_arg 0] 
        set forward_msg [join [lrange $forward_arg 1 end]] 

        if {$chan == $private_channel} { 
                if {$forward_msg != ""} { 
                        puthelp "PRIVMSG $forward_to :$forward_msg" 
                } { 
                        puthelp "PRIVMSG $chan :use: !forward <nick> <msg>" 
                } 
        } 
        return
} 

putlog "eggforward.tcl ver 0.1 by tomekk loaded"

Last edited by SpiKe^^ on Fri Jan 04, 2013 1:29 pm, edited 5 times in total.
SpiKe^^

Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
.
User avatar
caesar
Mint Rubber
Posts: 3776
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

You don't need to count the lines (length $dont_forward) cos if there aren't any the foreach loop won't execute anything.

Also, I think you meant break not return in:
if {[string match -nocase $item $arg]} { return }
Besides, you should check only the first argument (word) from user input against the $dont_forward variable, make $dont_forward a list and use lsearch (with -nocase to make it case insensitive) to see if that argument (command, word or whatever you want to call it) is in there or not.

Leave putquick to important stuff and use puthelp instead.

Edit: While we are at the MSGM subject, in the tcl-commands.doc I've noticed this:
If the exclusive-binds setting is enabled, MSG binds will not be triggered by text that a MSGM bind has already handled.
dose anyone know what's that exclusive-binds setting refers to?
Once the game is over, the king and the pawn go back in the same box.
User avatar
SpiKe^^
Owner
Posts: 831
Joined: Fri May 12, 2006 10:20 pm
Location: Tennessee, USA
Contact:

Post by SpiKe^^ »

caesar wrote:
You don't need to count the lines (length $dont_forward) cos if there aren't any the foreach loop won't execute anything.
O.K., I'll buy that:) Removed the check from the above script.
Also, I think you meant break not return in:
Quote:

if {[string match -nocase $item $arg]} { return }
Actually, I did mean return. If the typed text matches any of the string patterns in the dont_forward setting, I want the process to return out, and not say anything to the private_channel.
Besides, you should check only the first argument (word) from user input against the $dont_forward variable, make $dont_forward a list and use lsearch (with -nocase to make it case insensitive) to see if that argument (command, word or whatever you want to call it) is in there or not.
Actually, I did mean to do it the way I did, I just didn't explain the reasons why at all.
I was talking to the person I was fixing the script for on irc,
and they wanted to be able to keep the bot from forwarding text to the channel that contained bad words.
Believe you would have to do it the way i did to catch those bad words anywhere in the typed string.
Leave putquick to important stuff and use puthelp instead.
O.K., I'll buy that:) I did not write that part of the script, but have fixed the above script to reflect a more correct puthelp.
Edit: While we are at the MSGM subject, in the tcl-commands.doc I've noticed this:
Quote:

If the exclusive-binds setting is enabled, MSG binds will not be triggered by text that a MSGM bind has already handled.


dose anyone know what's that exclusive-binds setting refers to?
My understanding of that is:
Eggdrop processes MSGM binds first, before MSG binds.
With the exclusive-binds setting enabled, if this script was loaded on a bot, and someone was to try to op with the bot,
this script would trigger first.
Then, if the built in OP command is tied to a MSG bind, it will never trigger at all, because this script has already handled it.

I believe if you have any scripts with the bind: bind msgm - "*" anyproc
you can not ever enable that setting!
SpiKe^^

Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
.
User avatar
SpiKe^^
Owner
Posts: 831
Joined: Fri May 12, 2006 10:20 pm
Location: Tennessee, USA
Contact:

eggforward.tcl ver 0.2

Post by SpiKe^^ »

Well, was asked to make this script work for multiple bots all reporting to the same channel.
As it was, when you tried to make one bot reply to someone, they all did:)
This changes the trigger to !botnick if multi bot is enabled.

Code: Select all

# eggforward.tcl ver 0.2 by SpiKe^^ (3 Jan 2013) #

# author:  SpiKe^^ #
# e-mail:  spike<at>mytclscripts<dot>com #
# webpage: http://mytclscripts.com/ #

# This file is Copyrighted under the GNU Public License. #
# http://www.gnu.org/copyleft/gpl.html #

##### Based Almost Entirely on This Script by tomekk #####
# eggforward.tcl ver 0.1 by tomekk                       #
# Author: tomekk                                         #
#                                                        #
# e-mail:  tomekk/@/tomekk/./org                         #
# home page: http://tomekk.org/                          #
#                                                        #
# Version 0.1                                            #
#                                                        #
# This file is Copyrighted under the GNU Public License. #
# http://www.gnu.org/copyleft/gpl.html                   #
##########################################################

# Set the private channel (all msgs sent to the bot, will be sent here)
set private_channel "#private" 

# Enable multi bot support???  ( 0 = NO  |  1 = YES )
# 0 = The reply command is: !forward <target> <text>
# 1 = The reply command is: !<botnick> <target> <text>
set is_multi_bot "0"

# List things not to forward to the channel, one item per line: 
# List commands like this:  op * 
# List badwords like this:  * badword *  :or:  *badword* 
set dont_forward { 

  auth * 
  ident * 
  op * 

}  ;## end of dont_forward setting ## 

############################################################## 

bind msgm - "*" private_proc 
set dont_forward [split [string trim $dont_forward] \n]

proc lets_do_unbind {} {
 foreach bnd [binds forward_proc] {
  foreach {ty fl na hi pr} $bnd { break }
  unbind $ty $fl $na $pr
 }
}
lets_do_unbind

if {$is_multi_bot=="1"} {  bind pubm - "*" forward_proc 
} else {  bind pub - !forward forward_proc  }

proc private_proc { nick uhost hand arg } { 
  global private_channel dont_forward 

  foreach item $dont_forward { 
    set item [string trim $item] 
    if {[string match -nocase $item $arg]} {  return  } 
  } 

  if {[botonchan $private_channel]} { 
    puthelp "PRIVMSG $private_channel :$nick -> $arg" 
  } 
  return 
} 

proc forward_proc { nick uhost hand chan arg } { 
  global private_channel is_multi_bot botnick
  set forward_arg [split $arg] 

  if {$is_multi_bot=="1"} {  set trig [lindex $forward_arg 0]
    if {![string match -nocase $trig !$botnick]} {  return  }
    set forward_arg [lrange $forward_arg 1 end]
  } else {  set trig !forward  }

  set forward_to [lindex $forward_arg 0] 
  set forward_msg [join [lrange $forward_arg 1 end]] 

  if {[string match -nocase $chan $private_channel]} { 
    if {$forward_msg ne ""} { 
      puthelp "PRIVMSG $forward_to :$forward_msg" 
    } else { 
      puthelp "PRIVMSG $chan :use: $trig <nick> <msg>" 
    } 
  } 
  return 
} 

putlog "eggforward.tcl ver 0.2 by SpiKe^^ loaded" 

Last edited by SpiKe^^ on Fri Jan 04, 2013 1:28 pm, edited 1 time in total.
SpiKe^^

Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
.
User avatar
SpiKe^^
Owner
Posts: 831
Joined: Fri May 12, 2006 10:20 pm
Location: Tennessee, USA
Contact:

Post by SpiKe^^ »

One last try...
Adds a couple options and fixes some badword matching issues.

Code: Select all

# eggforward.tcl ver 0.3 by SpiKe^^ (4 Jan 2013) #

# author:  SpiKe^^ #
# e-mail:  spike<at>mytclscripts<dot>com #
# webpage: http://mytclscripts.com/ #

# This file is Copyrighted under the GNU Public License. #
# http://www.gnu.org/copyleft/gpl.html #

##### Based Almost Entirely on This Script by tomekk #####
# eggforward.tcl ver 0.1 by tomekk                       #
# Author: tomekk                                         #
#                                                        #
# e-mail:  tomekk/@/tomekk/./org                         #
# home page: http://tomekk.org/                          #
#                                                        #
# Version 0.1                                            #
#                                                        #
# This file is Copyrighted under the GNU Public License. #
# http://www.gnu.org/copyleft/gpl.html                   #
##########################################################

# Set the private channel (all msgs sent to the bot, will be sent here)
set private_channel "#private" 

# Enable multi bot support???  ( 0 = NO  |  1 = YES )
# 0 = The reply command is: !forward <target> <text>
# 1 = The reply command is: !<botnick> <target> <text>
set is_multi_bot "0"

# Set the command prefix for the !forward and !<botnick> triggers
set forward_cmd "!"

# List things not to forward to the channel, one item per line: 
# list commands first, then any badwords not to forward.
# List commands like this:  op * 
# List badwords like this:  * badword *  :or:  *badword*
#  Note: use * badword * for only the whole word 'badword'
#        use *badword* for anywhere in words (match. 'isabadword')
set dont_forward { 

  auth * 
  ident * 
  op * 

}  ;## end of dont_forward setting ## 

# If a msg to the bot contains a *badword*,
# would like a line sent to private_channel stating that??
# Leave this empty to just ignore message with badwords.
# or set this the the text to use (will be prefixed by: nick -> )
set say_badword "Message Contains badword"

############################################################## 

bind msgm - "*" private_proc 
set dont_forward [split [string trim $dont_forward] \n]
set say_badword [string trim $say_badword]

proc lets_do_unbind {} {
 foreach bnd [binds forward_proc] {
  foreach {ty fl na hi pr} $bnd { break }
  unbind $ty $fl $na $pr
 }
}
lets_do_unbind

if {$is_multi_bot=="1"} {  bind pubm - "*" forward_proc 
} else {  bind pub - ${forward_cmd}forward forward_proc  }

proc private_proc { nick uhost hand arg } { 
  global private_channel dont_forward say_badword

  foreach item $dont_forward { 
    set item [string trim $item] 

    if {[string index $item 0] eq "*"} {
      if {[string match -nocase $item " $arg "]} {
        if {$say_badword eq ""} {  return  }
        set arg $say_badword  ;  break
      }

    } elseif {[string match -nocase $item $arg]} {  return  } 
  } 

  if {[botonchan $private_channel]} { 
    puthelp "PRIVMSG $private_channel :$nick -> $arg" 
  } 
  return 
} 

proc forward_proc { nick uhost hand chan arg } { 
  global private_channel is_multi_bot botnick forward_cmd
  set forward_arg [split $arg] 

  if {$is_multi_bot=="1"} {  set trig [lindex $forward_arg 0]
    if {![string match -nocase $trig $forward_cmd$botnick]} { return }
    set forward_arg [lrange $forward_arg 1 end]
  } else {  set trig ${forward_cmd}forward  }

  set forward_to [lindex $forward_arg 0] 
  set forward_msg [join [lrange $forward_arg 1 end]] 

  if {[string match -nocase $chan $private_channel]} { 
    if {$forward_msg ne ""} { 
      puthelp "PRIVMSG $forward_to :$forward_msg" 
    } else { 
      puthelp "PRIVMSG $chan :use: $trig <nick> <msg>" 
    } 
  } 
  return 
} 

putlog "eggforward.tcl ver 0.3 by SpiKe^^ loaded" 

SpiKe^^

Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
.
k
kingkong
Voice
Posts: 10
Joined: Sun Apr 08, 2012 5:02 am

works great :)

Post by kingkong »

i tested it and works great. i formatted text colors and looks awesome. thanks you :)
Post Reply