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 

Write msg from notice

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests
View previous topic :: View next topic  
Author Message
Robertus
Voice


Joined: 23 Aug 2007
Posts: 11

PostPosted: Sat Feb 21, 2009 2:03 pm    Post subject: Write msg from notice Reply with quote

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
Back to top
View user's profile Send private message
tomekk
Master


Joined: 28 Nov 2008
Posts: 255
Location: Oswiecim / Poland

PostPosted: Sun Feb 22, 2009 8:44 am    Post subject: Reply with quote

try:
Code:
# 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? Smile
Back to top
View user's profile Send private message Visit poster's website
speechles
Revered One


Joined: 26 Aug 2006
Posts: 1398
Location: emerald triangle, california (coastal redwoods)

PostPosted: Sun Feb 22, 2009 2:40 pm    Post subject: Reply with quote

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.
_________________
speechles' eggdrop tcl archive
Back to top
View user's profile Send private message
Robertus
Voice


Joined: 23 Aug 2007
Posts: 11

PostPosted: Sun Feb 22, 2009 3:18 pm    Post subject: Reply with quote

nice it works, but i use blowfish and when bot write in channel, it write crypted Sad
Back to top
View user's profile Send private message
tomekk
Master


Joined: 28 Nov 2008
Posts: 255
Location: Oswiecim / Poland

PostPosted: Mon Feb 23, 2009 7:51 am    Post subject: Reply with quote

@speechles, yeah right

Code:
# 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.
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests 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