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.

Write msg from notice

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Post Reply
R
Robertus
Voice
Posts: 11
Joined: Thu Aug 23, 2007 8:10 pm

Write msg from notice

Post by Robertus »

hi everybody

i have a little problem, i want a simple tcl that write a message from a notice of a particular user with particular host.

example:

/notice mybot TEST1

on irc:

<mybot> TEST1

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

Post by tomekk »

try:

Code: Select all

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

# output channels
set output_chans {#channel1 #channel2}

# user host:
# *user@*.host.com,
# user@some.host.com
# user@some.*.com
# *@some.host.com
set user_host "user@some.host.com"

#################################################
bind notc - * notc_proc

proc notc_proc { nick uhost hand arg {dest ""}} {
	global output_chans user_host

	if {[string match $user_host $uhost]} {
       		foreach nchan [split $output_chans] {
			if {$nchan != ""} {
				if {[botonchan $nchan]} {
					putquick "PRIVMSG $nchan :$arg"
				}
			}
		}
	}
}

putlog "simple-notice.tcl ver 0.1 by tomekk loaded"
Is this enough for you? :)
User avatar
speechles
Revered One
Posts: 1398
Joined: Sat Aug 26, 2006 10:19 pm
Location: emerald triangle, california (coastal redwoods)

Post by speechles »

You don't check if the notice is sent to a channel or the bot. So anyone matching the host will have their notice relayed by the bot even in a channel notice. A channel notice by that user, in another channel will be sent to the output_chans which might not be wanted. You may want to add a check against $dest ( [string index $dest 0] == # ) to detect if it's to a channel or to the bot.
R
Robertus
Voice
Posts: 11
Joined: Thu Aug 23, 2007 8:10 pm

Post by Robertus »

nice it works, but i use blowfish and when bot write in channel, it write crypted :(
User avatar
tomekk
Master
Posts: 255
Joined: Fri Nov 28, 2008 11:35 am
Location: Oswiecim / Poland
Contact:

Post by tomekk »

@speechles, yeah right

Code: Select all

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

# output channels
set output_chans {#channel1 #channel2}

# user host:
# *user@*.host.com,
# user@some.host.com
# user@some.*.com
# *@some.host.com
set user_host "user@some.host.com"

#################################################
bind notc - * notc_proc

proc notc_proc { nick uhost hand arg {dest ""}} {
	global output_chans user_host botnick

	if {$dest == ""} {
		set dest $botnick
	}

	if {$dest == $botnick} {
		if {[string match $user_host $uhost]} {
       			foreach nchan [split $output_chans] {
				if {$nchan != ""} {
					if {[botonchan $nchan]} {
						putquick "PRIVMSG $nchan :$arg"
					}
				}
			}
		}
	}
}
putlog "simple-notice.tcl ver 0.1 by tomekk loaded"
@Robertus
You have to decrypt it or something.
Post Reply