From e6cc22dcd98951a1208d81f375f587d32c38a1d7 Mon Sep 17 00:00:00 2001 Message-Id: From: Mark Wooding Date: Tue, 5 Sep 2000 22:26:57 +0000 Subject: [PATCH] New help scheme. Organization: Straylight/Edgeware From: Ian Jackson --- bot.tcl | 50 ++++++++++++++++++++++++-------- helpinfos | 87 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 125 insertions(+), 12 deletions(-) create mode 100644 helpinfos diff --git a/bot.tcl b/bot.tcl index f171344..f3db5c1 100755 --- a/bot.tcl +++ b/bot.tcl @@ -486,21 +486,45 @@ proc ucmdr {priv pub args} { return -code return [concat [list $priv $pub] $args] } -proc ucmd_sendhelp {} { - ucmdr \ -{Commands currently understood: - help get this list of commands - seen ask after someone (I'll tell them you asked) - summon invite a logged-on user onto IRC -Send commands to me by /msg, or say them in channel with ! in front.} {} -# -# register register your nick (you must auth[*] first) -#[*]auth: /blight in ircII, or /msg blight authuser +proc loadhelp {} { + global help_topics + + catch { unset help_topics } + set f [open helpinfos r] + set lno 0 + while {[gets $f l] >= 0} { + incr lno + if {[regexp {^#.*} $l]} { + } elseif {[regexp {^ *$} $l]} { + if {[info exists topic]} { + set help_topics($topic) [join $lines "\n"] + unset topic + unset lines + } + } elseif {[regexp {^!([-+._0-9a-z]*)$} $l dummy newtopic]} { + if {[info exists topic]} { error "help $newtopic while in $topic" } + set topic $newtopic + set lines {} + } elseif {[regexp {^[^!#]} $l]} { + set topic + lappend lines [string trimright $l] + } else { + error "eh ? $lno: $l" + } + } + if {[info exists topic]} { error "unfinished topic $topic" } } -def_ucmd help { ta_nomore; ucmd_sendhelp } +def_ucmd help { + upvar #0 help_topics([irctolower [string trim $text]]) info + if {![info exists info]} { error "no help on $text, sorry." {} } + ucmdr $info {} +} -def_ucmd ? { ta_nomore; ucmd_sendhelp } +def_ucmd ? { + global help_topics + ucmdr $help_topics() {} +} proc manyset {list args} { foreach val $list var $args { @@ -597,6 +621,8 @@ if {![info exists sock]} { fileevent $sock readable onread } +loadhelp + #if {![regexp {tclsh} $argv0]} { # vwait terminate #} diff --git a/helpinfos b/helpinfos new file mode 100644 index 0000000..09587fa --- /dev/null +++ b/helpinfos @@ -0,0 +1,87 @@ +! +General commands: Registration and user settings: + help [||] register [insecure|delete] + seen set [ []] + summon (See `help identify'.) + convert Channel settings: + ops oplist [] [+|-|= [?] ...] +Options: Additional help topics: + timeformat ks|hms identify identpass invite +Send commands to me by /msg, or say them in channel with ! in front. + +!help +help gives an overview and lists the topics &c +help gives help on a command +help gives help on an option +help gives help on an additional topic + +!seen +seen + Tells you or the channel when I last saw that nick in + use. When the nick is next used, I'll tell them you asked. + +!summon +summon + Invites a logged-on user onto IRC. If the user is not logged on + you'll be told. Target users can change this (eg, to disable it) + by reconfiguring the userv service `irc-summon'. See ~ian/.userv. + +!convert +convert + Converts the specified quantity into SI units. Units that are + understood are any understood by units(1) and also + kelvin celsius fahrenheit (convert to celsius or kelvin) + +!ops +ops on channel +ops (privately) + Asks me to give you channel operator privilege. You must have + identified yourself (see `help identification'). + +!oplist +oplist [] show chop list +oplist [] + ... add nicks to chop list +oplist [] - ... remove nicks from chop list +oplist [] = ... set chop list + Configures the list of who may use the `ops' command. You must be + on the oplist yourself to do this. If you op me on a channel I'll + automatically add you to the oplist if you have identified yourself. + +!identify +You must identify yourself to change your settings and to use channel +management commands. In ircII on chiark, just say `/blight-id'. For +other clients, see `help identpass'. Once you are identified you can +then register new nicks, change settings, etc. - so long as you +remain on a channel that I'm on too. (See also `help invite'.) + +!identpass +identpass + Identification, for example with /blight-id, is actually done with + `identpass', which passes the md5sum of the password to `userv + irc-identpass '. That must exit 0 if all is well. + +!invite +If you invite me to a channel I'll join it. + +!register +register register your nick (or make it secure) +register delete delete your nick registration +register insecure register your nick insecurely + I only store settings for registered nicks. For `insecure' nicks + anyone who currently holds that nick can change its settings, + including securing it to their username. `secure' nicks can only + have their settings changed by the user to which they are + registered, after identifying themselves (see `help identify'). + +!set +set show your current settings +set