| View previous topic :: View next topic |
| Author |
Message |
duarteper Voice
Joined: 06 Dec 2012 Posts: 12
|
Posted: Thu Dec 06, 2012 11:21 pm Post subject: Fake user tcl |
|
|
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 |
|
| Back to top |
|
 |
tomekk Master

Joined: 28 Nov 2008 Posts: 255 Location: Oswiecim / Poland
|
Posted: Fri Dec 07, 2012 2:41 pm Post subject: |
|
|
| Code: | | cmd ex: !BotNick Nick hello |
You want to use this command on this 'private' channel or? |
|
| Back to top |
|
 |
duarteper Voice
Joined: 06 Dec 2012 Posts: 12
|
Posted: Fri Dec 07, 2012 4:10 pm Post subject: |
|
|
| i wont use this comand in channel and see the bot private messages in channel as well |
|
| Back to top |
|
 |
tomekk Master

Joined: 28 Nov 2008 Posts: 255 Location: Oswiecim / Poland
|
Posted: Fri Dec 07, 2012 4:40 pm Post subject: |
|
|
| Code: | # 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/ |
|
| Back to top |
|
 |
duarteper Voice
Joined: 06 Dec 2012 Posts: 12
|
Posted: Fri Dec 07, 2012 6:04 pm Post subject: thanks a lot tomekk |
|
|
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 |
|
| Back to top |
|
 |
janii Halfop
Joined: 03 Aug 2011 Posts: 41
|
Posted: Sun Dec 23, 2012 7:28 pm Post subject: |
|
|
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 |
|
| Back to top |
|
 |
SpiKe^^ Owner

Joined: 12 May 2006 Posts: 792 Location: Tennessee, USA
|
Posted: Sun Dec 23, 2012 8:32 pm Post subject: |
|
|
janii wrote...
| Quote: | 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
. |
|
| Back to top |
|
 |
SpiKe^^ Owner

Joined: 12 May 2006 Posts: 792 Location: Tennessee, USA
|
Posted: Thu Jan 03, 2013 1:26 pm Post subject: |
|
|
This should keep the bot from sending your password to the private channel when doing '/msg botnick auth pass' command...
| Code: |
# 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"
|
_________________ SpiKe^^
Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
.
Last edited by SpiKe^^ on Fri Jan 04, 2013 1:29 pm; edited 5 times in total |
|
| Back to top |
|
 |
caesar Mint Rubber

Joined: 14 Oct 2001 Posts: 3741 Location: Mint Factory
|
Posted: Thu Jan 03, 2013 3:30 pm Post subject: |
|
|
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:
| Quote: |
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:
| 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? _________________ Once the game is over, the king and the pawn go back in the same box. |
|
| Back to top |
|
 |
SpiKe^^ Owner

Joined: 12 May 2006 Posts: 792 Location: Tennessee, USA
|
Posted: Thu Jan 03, 2013 9:03 pm Post subject: |
|
|
caesar wrote:
| Quote: | | 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.
| Quote: | 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.
| Quote: | | 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.
| Quote: | | 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.
| Quote: | 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
. |
|
| Back to top |
|
 |
SpiKe^^ Owner

Joined: 12 May 2006 Posts: 792 Location: Tennessee, USA
|
Posted: Thu Jan 03, 2013 10:47 pm Post subject: eggforward.tcl ver 0.2 |
|
|
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: |
# 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"
|
_________________ SpiKe^^
Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
.
Last edited by SpiKe^^ on Fri Jan 04, 2013 1:28 pm; edited 1 time in total |
|
| Back to top |
|
 |
SpiKe^^ Owner

Joined: 12 May 2006 Posts: 792 Location: Tennessee, USA
|
Posted: Fri Jan 04, 2013 1:26 pm Post subject: |
|
|
One last try...
Adds a couple options and fixes some badword matching issues.
| Code: |
# 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
. |
|
| Back to top |
|
 |
kingkong Voice
Joined: 08 Apr 2012 Posts: 10
|
Posted: Fri Jan 04, 2013 8:40 pm Post subject: works great :) |
|
|
i tested it and works great. i formatted text colors and looks awesome. thanks you  |
|
| Back to top |
|
 |
|