| View previous topic :: View next topic |
| Author |
Message |
Aditya Voice

Joined: 08 May 2006 Posts: 8 Location: New York
|
Posted: Fri Jun 16, 2006 6:42 am Post subject: !info Simple TCL |
|
|
Hi People!
I would like to know if there is a script which has the below feature existing .. if not, can anyone make it up please
1) On !info in a channel the bot should respond to the performed chatter with a list of information about the channel
2) The information should be listed as 1) .. 2).. and 3)....
3) The Information should be ONLY through /notice and not /privmsg..
Thanks / Rgds
Aditya @ DALnet
#TownHall, #HomeTown |
|
| Back to top |
|
 |
Access Voice
Joined: 04 Jun 2006 Posts: 22
|
Posted: Fri Jun 16, 2006 8:03 am Post subject: |
|
|
| which kind of information about the channel?! |
|
| Back to top |
|
 |
De Kus Revered One

Joined: 15 Dec 2002 Posts: 1361 Location: Germany
|
Posted: Fri Jun 16, 2006 9:05 am Post subject: |
|
|
there are a lot of "trigger scripts" around here, either reading from a file or using integrated strings. In case the desired script uses PRIVMSG instead of NOTICE... I suggest to simply replace PRIVMSG with NOTICE, the syntax of these IRC commands is the same 'COMMAND TARGET[,MORETAGETS,..] :TEXT' . _________________ De Kus
StarZ|De_Kus, De_Kus or DeKus on IRC
Copyright © 2005-2009 by De Kus - published under The MIT License
Love hurts, love strengthens... |
|
| Back to top |
|
 |
Minus Voice
Joined: 01 Jul 2006 Posts: 8
|
Posted: Tue Jul 04, 2006 4:45 am Post subject: |
|
|
This is a modified command script see if you like it.
cmds are !info add,del,help
| Code: | ##
#
# commands.tcl v1.2 - by strikelight ([sL] @ EFNet) (09/21/03)
#
# For eggdrop1.1.5-eggdrop1.6.x
#
# Contact:
# - E-Mail: strikelight@tclscript.com
# - WWW : http://www.TCLScript.com
# - IRC : #Scripting @ EFNet
#
##
#
# Description:
#
# This script will allow channel administrators to maintain a list of
# available triggers for the channel, and allow users to view the list
# of available triggers.
#
##
#
# History:
#
# (09/21/03)/v1.2 - Cosmetic fixes
#
# (10/20/02)/v1.1 - Fixed bug with error on startup:
# "can't read 'eggversion': no such variable"
# (Why didn't anyone else report this a long time ago?)
# - Added option to change the trigger command
#
# (5/27/02)/v1.0 - Initial Release
#
##
#
# Usage:
#
# Edit the configuration below, and
# type "!commands help" in a channel
#
# (Modify '!commands help' with the trigger you choose below in the config)
#
##
## CONFIGURATION ##
# Trigger to use?
set commands_trigger "!info"
# Flag required to add/remove triggers
set commands_adminflag "m"
## END OF CONFIG ##
set commands_version "1.2"
set eggversion [string trimleft [lindex $version 1] 0]
bind pub - $commands_trigger commands:pub
proc handisop {hand chan} {
return [expr {[validchan $chan] && [isop [hand2nick $hand $chan] $chan]}]
}
if {($eggversion >= 1030000)} {
proc matchchanattr {handle flags channel} { return [matchattr $handle |$flags $channel] }
}
proc isoporvoice {nick chan} {
return [expr {[validchan $chan] && ([isop $nick $chan] || [isvoice $nick $chan])}]
}
proc handisoporvoice {hand chan} {
return [expr {[validchan $chan] && [isoporvoice [hand2nick $hand $chan] $chan]}]
}
proc mymatchattr {hand flags {chan ""}} {
if {[regsub -all {[^&|().a-zA-Z0-9@+#-]} $flags {} f]} {
putloglev o * "error: (matchattr): illegal character in flags: $flags"
return 0
}
regsub -all -- {[|&]} $f {&&} f
regsub -all -- {#-} $f {-#} f
regsub -all -- {-} $f {!} f
regsub -all -- {#?[a-zA-Z0-9]} $f {(&)} f
regsub -all -- {\(#([a-zA-Z0-9])\)} $f {[matchchanattr $hand \1 $chan]} f
regsub -all -- {\(([a-zA-Z0-9])\)} $f {[matchattr $hand \1]} f
regsub -all -- {\.} $f {1} f
regsub -all -- {@} $f {[handisop $hand $chan]} f
regsub -all -- {\+} $f {[handisoporvoice $hand $chan]} f
return [expr $f]
}
proc commands:load {} {
global commands
catch {unset commands}
if {![file exists "commands.dat"]} {
set outfile [open "commands.dat" w]
close $outfile
}
set infile [open "commands.dat" r]
set buffer [read $infile]
close $infile
set buffer [split $buffer "\n"]
foreach line $buffer {
if {$line != ""} {
set dline [split $line "|"]
set dchan [string tolower [lindex $dline 0]]
set dcmd [lindex $dline 1]
set ddesc [lindex $dline 2]
set commands($dchan,$dcmd) $ddesc
}
}
return 1
}
proc commands:save {} {
global commands
set outfile [open "commands.dat" w]
foreach item [array names commands *,*] {
set dchan [lindex [split $item ","] 0]
set dcmd [lindex [split $item ","] 1]
set ddesc $commands($item)
if {($dchan != "") && ($dcmd != "") && ($ddesc != "")} {
puts $outfile "$dchan|$dcmd|$ddesc"
}
}
close $outfile
return 1
}
proc commands:longestcmd {chan} {
global commands
set i 0
foreach item [array names commands [string tolower $chan],*] {
set ditem [join [lindex [split $item ","] 1]]
if {[string length $ditem] > $i} { set i [string length $ditem] }
}
return $i
}
proc commands:iscommand {command chan} {
global commands
return [info exists commands([string tolower $chan],$command)]
}
proc commands:add {command desc chan} {
global commands
if {[commands:iscommand $command $chan]} { return 0 }
set commands([string tolower $chan],$command) "$desc"
return 1
}
proc commands:del {command chan} {
global commands
if {![commands:iscommand $command $chan]} { return 0 }
catch {unset commands([string tolower $chan],$command)}
return 1
}
proc commands:pub {nick uhost hand chan rest} {
global commands commands_adminflag commands_trigger
set cmd [string tolower [lindex [split $rest] 0]]
set chan [string tolower $chan]
switch $cmd {
help {
set tt $commands_adminflag
puthelp "NOTICE $nick :+- \002info.tcl\002 help"
puthelp "NOTICE $nick :: [format %-39s "$commands_trigger"] - list of commands available in channel"
if {[mymatchattr $hand $tt|#$tt $chan]} {
puthelp "NOTICE $nick :: [format %-39s "$commands_trigger add {<info>} <tekst>"] - add a command to channel"
puthelp "NOTICE $nick :: [format %-39s "$commands_trigger del {<info>}"] - remove a command for channel"
}
puthelp "NOTICE $nick :+- end of help."
return
}
add {
set tt $commands_adminflag
if {![mymatchattr $hand $tt|#$tt $chan]} { return }
set command [lindex $rest 1]
set desc [join [lrange $rest 2 end]]
if {($command == "") || ($desc == "")} {
puthelp "NOTICE $nick :Usage: $commands_trigger add {<info>} <tekst>"
puthelp "NOTICE $nick :Eg. : $commands_trigger add {/ctcp lamer test} does something"
return
}
set res [commands:add $command "$desc" $chan]
if {!$res} {
puthelp "NOTICE $nick :\002$command\002 is already marked as a info for $chan."
return
} else {
puthelp "NOTICE $nick :Added \002$command\002 as a info for $chan."
commands:save
return
}
}
del {
set tt $commands_adminflag
if {![mymatchattr $hand $tt|#$tt $chan]} { return }
set command [lindex $rest 1]
if {$command == ""} {
puthelp "NOTICE $nick :Usage: $commands_trigger del <command>"
return
}
set res [commands:del $command $chan]
if {!$res} {
puthelp "NOTICE $nick :\002$command\002 is not a command for $chan."
return
} else {
puthelp "NOTICE $nick :Deleted \002$command\002 as a info for $chan."
commands:save
return
}
}
default {
set lngth [commands:longestcmd $chan]
if {!$lngth} { return }
if {$lngth < 8} { set lngth 8 }
puthelp "NOTICE $nick :+- information for \002$chan\002:"
puthelp "NOTICE $nick :: \037[format %-${lngth}s "info\037"] - \037tekst\037"
foreach item [lsort [array names commands $chan,*]] {
puthelp "NOTICE $nick :: \002[format %-${lngth}s "[lindex [split $item ","] 1]"]\002 - $commands($item)"
}
puthelp "NOTICE $nick :+- end of info."
return
}
}
}
commands:load
putlog "info.tcl v$commands_version by strikelight now loaded." |
|
|
| Back to top |
|
 |
|
|
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
|
|