Ok, here's an update to allow inclusion of who changed the keyword last. I'm going to use !whoset instead of ?whoset to keep it matching the rest of the commands. You can always change it if you want to.
Keep in mind that this will require you to clear your current hash file and start fresh if you've already used this script because it is now storing the nicks. To do so, you'll want to type:
/hfree Help
/remove Help.hsh
Then, you can use the updated script.
alias -l CreateHelp {
hmake Help 100
if ($isfile(Help.hsh)) { hload Help Help.hsh }
}
on *:start: {
CreateHelp
}
on *:text:*:#: {
if ($1 != !learn && $1 != !replace && $1 != !append && $1 != !delete && $1 != !whoset && $1 != $chr(63)) { return }
if (!$2) { msg $chan Please include a keyword with the command | return }
if ($hget(Help) == $null) { CreateHelp }
if ($1 == !learn) {
if ($hget(Help,$2)) { msg $chan That keyword is already used. Please choose another, or use !replace or !append. | return }
msg $chan Learned $3-
hadd Help $2 $nick $3-
}
elseif ($1 == $chr(63)) {
var %data = $gettok($hget(Help,$2),2-,32)
if (%data == $null) { msg $chan No help available on that item. }
else {
msg $chan %data
}
}
elseif ($1 == !replace) {
if ($hget(Help,$2)) {
msg $chan Replaced $gettok($hget(Help,$2),2-,32) with $2-
hadd Help $2 $nick $3-
}
else msg $chan No such keyword ( $+ $2 $+ ).
}
elseif ($1 == !append) {
if ($hget(Help,$2)) {
msg $chan Appended $3- to $hget(Help,$2)
hadd Help $2 $nick $gettok($hget(Help,$2),2-,32) $3-
}
else msg $chan No such keyword ( $+ $2 $+ ).
}
elseif ($1 == !delete) {
if ($hget(Help,$2)) {
msg $chan Deleted $2 -- $gettok($hget(Help,$2),2-,32)
hdel Help $2
}
else msg $chan No such keyword ( $+ $2 $+ ).
}
elseif ($1 == !whoset) {
if ($hget(Help,$2)) {
msg $chan $gettok($hget(Help,$2),1,32) was the last person to update $2 $+ .
}
else msg $chan No such keyword ( $+ $2 $+ ).
}
hsave Help Help.hsh
}
USE:
!learn keyword description
!replace keyword new_description
!append keyword new_part_of_description
!delete keyword
!whoset keyword
? keyword
Need anything else that I listed?
And I still would recommend limiting this to specific users. If you want to do that, let me know. The easiest way would be to add them to your user list and then set the on text to only trigger for that user level. Then we'd just pull the viewing trigger out of that on text and put it on its own. It's up to you.
*EDIT* Updated after realizing I forgot to change some things after adding !whoset support.