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 

Script to relay a Single User.

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


Joined: 14 Aug 2012
Posts: 10

PostPosted: Thu Apr 25, 2013 2:15 am    Post subject: Script to relay a Single User. Reply with quote

I am searching for a script which can relay a single user only. The ones I have found are the ones which relays the whole channel.

For eg,

I have added Xyz@192.168.1.1 to the list and the bot only relays what 'XYZ' says on a channel to a different channel.

<XYZ> The CUZ is going to have lunch.

I want this line to be relayed without the nick and with the bold/colors etc like,

The CUZ is going to have lunch.

Any help in this case will be highly appreciated.

Thanks.
Back to top
View user's profile Send private message
Madalin
Master


Joined: 24 Jun 2005
Posts: 310
Location: Constanta, Romania

PostPosted: Thu Apr 25, 2013 11:04 am    Post subject: Reply with quote

Test this and tell me if this is what you wanted

Code:

bind PUBM - * pub_random

set temp(to) "#to"
set temp(allow) {
   "nick1"
   "nick2"
}

proc pub_random {nick mask hand channel arg} {
   global temp

   foreach n $temp(allow) { if {[string tolower $nick] == [string tolower $n]} {
         putquick "PRIVMSG $temp(to) :$arg"
      }
   }
}

_________________
https://github.com/MadaliNTCL - To chat with me: https://tawk.to/MadaliNTCL
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger
caesar
Mint Rubber


Joined: 14 Oct 2001
Posts: 3741
Location: Mint Factory

PostPosted: Thu Apr 25, 2013 2:15 pm    Post subject: Reply with quote

He asked for a user@host match, not a nick one, not to mention that you could use lsearch instead of the foreach loop.
Code:

set relayList [list "user@host.com" "*@blah.net" "Xyz@192.168.1.1"]

bind PUBM - * relayPubm

proc relayPubm {nick uhost hand chan text} {
   if {[lsearch -glob $::relayList "$uhost"]!=-1]} {
      puthelp "PRIVMSG #relay_channel :$text"
   }
}

Btw, it's healthy to break the loop in case of a match and use puthelp and leave putquick for other important stuff.
_________________
Once the game is over, the king and the pawn go back in the same box.
Back to top
View user's profile Send private message
gamer12
Voice


Joined: 14 Aug 2012
Posts: 10

PostPosted: Fri Apr 26, 2013 11:47 am    Post subject: thanks! Reply with quote

yes it worked fine! thanks both of you!
Back to top
View user's profile Send private message
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