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.

Common channels

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Post Reply
D
DaRkOoO
Halfop
Posts: 67
Joined: Sat Sep 27, 2008 7:27 am

Common channels

Post by DaRkOoO »

Hi all,

I need script which will make my bot to say common channels with some other nick.Should work like .common <nick>
Bot:My common channels with <nick> are: #chan1 #chan2 etc..

Regards,
Darko.
User avatar
BLaCkShaDoW
Op
Posts: 120
Joined: Sun Jan 11, 2009 4:50 am
Location: Romania
Contact:

Post by BLaCkShaDoW »

BLaCkShaDoW Production @ WwW.TclScripts.Net
User avatar
speechles
Revered One
Posts: 1398
Joined: Sat Aug 26, 2006 10:19 pm
Location: emerald triangle, california (coastal redwoods)

Post by speechles »

Wow, there is no need to issue a whois to do this, nor is reading raw replies even necessary. Not to mention the huge flaw in that script's display. It won't display them all on one line as the poster suggested.
It has the putserv done incorrectly, for some reason it is within the foreach. This means it will spam so much it's likely if the poster's bot and the nickname share enough common channels the bot will be killed for issuing an excess text flood.

Just use the small script below and remember on partyline to .chanset #yourchan +common after you source it. This will work exactly as the poster has requested.

Code: Select all

setudef flag common
bind pub - .common check:common

proc check:common {nick uhost hand chan text} {
   if {![channel get $chan common]} { return }
   if {![string length [set n [lindex [split $text] 0]]]} {
     puthelp "Usage: .common <nick> - please supply nickname ;P"
     return
   }
   foreach c [channels] {
      if {[onchan $n $c]} { lappend common $c }
   }
   if {[info exists common]} {
      puthelp "privmsg $chan :My common channels with $n are: [join $common ", "]."
   } else {
      puthelp "privmsg $chan :I share no common channels with $n."
   }
}
D
DaRkOoO
Halfop
Posts: 67
Joined: Sat Sep 27, 2008 7:27 am

Post by DaRkOoO »

Thanks,that script is doing its job very good =)
Post Reply