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.

help me on join chan auto whois code pls

Help for those learning Tcl or writing their own scripts.
Post Reply
k
kn1ghtt
Voice
Posts: 10
Joined: Mon Aug 01, 2022 12:54 am

help me on join chan auto whois code pls

Post by kn1ghtt »

hello all

help me on join chan auto whois code pls code ..

Code: Select all

##############################################################################################
##  ##     whois.tcl for eggdrop by Ford_Lawnmower irc.geekshed.net #Script-Help        ##  ##
##############################################################################################
## To use this script you must set channel flag +whois (ie .chanset #chan +whois)           ##
##############################################################################################
##      ____                __                 ###########################################  ##
##     / __/___ _ ___ _ ___/ /____ ___   ___   ###########################################  ##
##    / _/ / _ `// _ `// _  // __// _ \ / _ \  ###########################################  ##
##   /___/ \_, / \_, / \_,_//_/   \___// .__/  ###########################################  ##
##        /___/ /___/                 /_/      ###########################################  ##
##                                             ###########################################  ##
##############################################################################################
##  ##                             Start Setup.                                         ##  ##
##############################################################################################
namespace eval whois {
## change cmdchar to the trigger you want to use                                        ##  ##
  variable cmdchar "!"
## change command to the word trigger you would like to use.                            ##  ##
## Keep in mind, This will also change the .chanset +/-command                          ##  ##
  variable command "whois"
## change textf to the colors you want for the text.                                    ##  ##
  variable textf "\017\00302"
## change tagf to the colors you want for tags:                                         ##  ##
  variable tagf "\017\002"
## Change logo to the logo you want at the start of the line.                           ##  ##
  variable logo "\017\00304\002\[\00306W\003hois\00304\]\017"
## Change lineout to the results you want. Valid results are channel users modes topic  ##  ##
  variable lineout "channel users modes topic"
##############################################################################################
##  ##                           End Setup.                                              ## ##
##############################################################################################
  variable channel ""
  setudef flag $whois::command
  bind pub -|- [string trimleft $whois::cmdchar]${whois::command} whois::lst
  bind raw -|- "311" whois::311
  bind raw -|- "312" whois::312
  bind raw -|- "319" whois::319
  bind raw -|- "317" whois::317
  bind raw -|- "313" whois::multi
  bind raw -|- "310" whois::multi
  bind raw -|- "335" whois::multi
  bind raw -|- "301" whois::301
  bind raw -|- "671" whois::multi
  bind raw -|- "320" whois::multi
  bind raw -|- "401" whois::multi
  bind raw -|- "318" whois::318
  bind raw -|- "307" whois::307
}
proc whois::311 {from key text} {
  if {[regexp -- {^[^\s]+\s(.+?)\s(.+?)\s(.+?)\s\*\s\:(.+)$} $text wholematch nick ident host realname]} {
    putserv "PRIVMSG $whois::channel :${whois::logo} ${whois::tagf}Nick e IP virtual:${whois::textf} \
        $nick \(${ident}@${host}\)"
   putserv "PRIVMSG $whois::channel :${whois::logo} ${whois::tagf}Nombre:${whois::textf} $realname"
  }
}
proc whois::multi {from key text} {
  if {[regexp {\:(.*)$} $text match $key]} {
  set keys [subst $$key]
  set keys [lrange $keys 4 8]
  if {"$keys" == "Nick no presente en IRC"} { set keys [encoding convertfrom utf-8 "El nick que buscas, no está conectado al IRC."];
      putserv "PRIVMSG $whois::channel :${whois::logo} ${whois::tagf}Info:${whois::textf} $keys";
         return 1    
   }   
  }
}
proc whois::312 {from key text} {
  regexp {([^\s]+)\s\:} $text match server
  putserv "PRIVMSG $whois::channel :${whois::logo} ${whois::tagf}Servidor:${whois::textf} $server"
}
proc whois::319 {from key text} {
  if {[regexp {.+\:(.+)$} $text match channels]} {
    putserv "PRIVMSG $whois::channel :${whois::logo} ${whois::tagf}Canales:${whois::textf} $channels"
  }
}
proc whois::317 {from key text} {
  if {[regexp -- {.*\s(\d+)\s(\d+)\s\:} $text wholematch idle signon]} {
  set signonsp [duration [expr [unixtime] - $::uptime]]
  set signonsp [string map [list "year" "años" "years" "años" "month" "mes" "months" "meses" "week" "semana" "weeks" "semanas" "day" "día" "days" "días" "hour" "hora" "hours" "horas" "minute" "minuto" "minutes" "minutos" "second" "segundo" "seconds" "segundos"] $signonsp]
  set idlesp [duration $idle]
  set idlesp [string map [list "year" "años" "years" "años" "month" "mes" "months" "meses" "week" "semana" "weeks" "semanas" "day" "día" "days" "días" "hour" "hora" "hours" "horas" "minute" "minuto" "minutes" "minutos" "second" "segundo" "seconds" "segundos"] $idlesp]
    putserv "PRIVMSG $whois::channel :${whois::logo} ${whois::tagf}Conectado :${whois::textf} \
        $signonsp ${whois::tagf}Inactivo:${whois::textf} $idlesp"
  }
}
proc whois::301 {from key text} {
  if {[regexp {^.+\s[^\s]+\s\:(.*)$} $text match awaymsg]} {
    putserv "PRIVMSG $whois::channel :${whois::logo} ${whois::tagf}Away:${whois::textf} $awaymsg"
  }
}
proc whois::318 {from key text} {
  namespace eval whois {
        variable channel ""
  }
  variable whois::channel ""
}
proc whois::307 {from key text} {
  putserv "PRIVMSG $whois::channel :${whois::logo} ${whois::tagf}Estado:${whois::textf} Nick Registrado"
}
proc whois::lst {nick host hand chan text} {
  if {[lsearch -exact [channel info $chan] "+${whois::command}"] != -1} {
    namespace eval whois {
          variable channel ""
        }
    variable whois::channel $chan
##In the chathispano network the correct command is '/whois nick nick', if you put only '/whois nick' the network hidden  'uptime' and 'idle'  information of nick.##
    putserv "WHOIS $text $text"
  }
}
User avatar
CrazyCat
Revered One
Posts: 1216
Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:

Post by CrazyCat »

What is the trouble ? You just want to make the script run automatically on join ?
Add a bind join.
s
simo
Revered One
Posts: 1071
Joined: Sun Mar 22, 2015 2:41 pm

Post by simo »

That's gonna be extremely spammy tho and possibly have your bot disconnect due to excess flood (excessive command use )
k
kn1ghtt
Voice
Posts: 10
Joined: Mon Aug 01, 2022 12:54 am

Post by kn1ghtt »

example :

Code: Select all

set whois_debugchan "#canal_ops"
set whois_mainchan "#canal"

bind join -|- * whois_cmd
bind raw -|- "319" whois_channels

proc whois_cmd {n u h c} {
	global whois_mainchan
	if {[string tolower $c] == [string tolower $whois_mainchan]} {
		putserv "WHOIS $n"
	}
}

proc whois_channels {f k t} {
	global whois_debugchan whois_mainchan botnick
	set whois_nick [lindex [split $t " "] 1]
	set whois_chan [string range [lindex [lrange [split $t " "] 2 end-1]] 1 end]
	if {$whois_nick != $botnick } {
		putserv "PRIVMSG $whois_debugchan :Canales de \002$whois_nick\002 -> $whois_chan"
	}
}

putlog "Script autowhois cargado"


bot: (Join) nick ident@vhost ingresa a #chan
bot: Modos: CHaN aplica +v nick en #chan
bot: (Realname) realnamenick
bot: (channels) #chan1 #chan2 chan3
bot: (IP) vhost.aqui de nick
bot: (Nodo) server.connect
bot: (ID) nick ident Chat
bot: (Conectado) 8secs (Inactividad) 5secs de nick
bot: (Quit) nick Deja el canal #chan


please help me and code
k
kn1ghtt
Voice
Posts: 10
Joined: Mon Aug 01, 2022 12:54 am

Post by kn1ghtt »

CrazyCat wrote:What is the trouble ? You just want to make the script run automatically on join ?
Add a bind join.
yes automatically on join whois

channel1 "#channel"
channelreport "#channelbotinfowhois"

example bot report #channelbotinfowhois join user #channel

bot: (Join) nick ident@vhost ingresa a #chan
bot: Modos: CHaN aplica +v nick en #chan
bot: (Realname) realnamenick
bot: (channels) #chan1 #chan2 chan3
bot: (IP) vhost.aqui de nick
bot: (Nodo) server.connect
bot: (ID) nick ident Chat
bot: (Conectado) 8secs (Inactividad) 5secs de nick
bot: (Quit) nick Deja el canal #chan
Post Reply