uhub/doc/ucmd.conf
Blair Bonnett 2e7f0f9c12 Add plugin to send user commands.
Adds a mod_ucmd plugin which uses the previously added user command
plugin functions to send user commands when users log in. These are read
from a text file in a simple format. They can be restricted to users
with certain credentials, and can have multiple actions (e.g., send a PM
and a message in the main chat).

A sample user command file for the standard uhub commands is at
doc/ucmd.conf, and will be automatically installed if appropriate.

This currently won't send commands to existing users (e.g., if the
plugin is (re)loaded after the hub is already up and running). To
support this, a plugin function to list all current users would need to
be added.

I'm not sure how efficient this would be due to the volume of
messages needed to delete the existing commands on shutdown and send
them again on startup. As the commands are reloaded properly within the
plugin, it may be easier to require users to reconnect after the
configuration changes (and, of course, an admin could force this by
restarting the hub).
2012-08-08 19:34:19 +12:00

161 lines
6.1 KiB
Plaintext

# User command configuration for standard uhub commands.
#
# Each command contains at least two lines: the first defines the command name
# and required credentials, and the following lines define the action(s) taken
# by the client when the user selects the command.
#
# Leading and trailing whitespace is trimmed from each line. Commented lines
# and blank lines are ignored. All keywords in the file are not case sensitive.
#
# Command definition
# ------------------
#
# The first line of a command defines the credentials required, the context(s)
# that the command should be shown in, and the name it is displayed as in the
# user command menu. It takes the following format:
#
# <credential level required> <list of contexts> <command name>
#
# The credential level is the minimum credentials required to access the
# command. Anybody with this level or greater will be able to see it. The
# levels are: 0 = none, 1 = bot, 2 = unregistered user, 3 = registered user,
# 4 = operator, 5 = super (not used currently), 6 = link (not used currently),
# 7 = admin.
#
# The contexts are a comma separated list which tell the client where to
# display the command. Possible values are:
#
# * hub: in a general right-click menu for the hub
# * user: in a right-click menu in the user list
# * search: in a search results window
# * filelist: in a file list window
# * all: all of the above
#
# The command name is what is displayed in the client menu and *must* be unique
# as the clients use it as an identifier.
#
# Nested menus can be created by adding backslashes (\) to the name, for example,
# User actions\Kick. NB. the ADC UCMD extension specifies a forward slash (/),
# but all clients appear to use the backslash as per the old NMDC protocol, so
# the backslash is recommended.
#
# Actions
# -------
#
# Following the command definition, one or more lines are given to specify the
# action or actions the client should take when the user selects the command.
# The order of the actions in this file is the order the client will perform
# them. There are three actions available, each of which can be used multiple
# times in a command:
#
# Chat <me> <message>
# Sends a message in the main chat window. The <me> parameter is 0 or 1, with 1
# meaning it is formatted as a /me <action> style message by clients.
#
# PM <echo> <target> <message>
# Sends a private message. If you have set up a user with a reserved SID, you
# can specify the SID the target. Alternatively, you can use the word Selected
# as the target to specify the currently selected user (this won't work in the
# hub context, as there is no user selected there). The <echo> parameter can be
# 0 or 1, with 1 specifying the message should be echoed to the sending user as
# well.
#
# Separator
# Specifies that the entry should be displayed as a separator instead of text,
# meaning there is no 'real' action to run. If this is given, any other actions
# will be ignored. A unique name is still required for each separator.
#
# Substitutions
# -------------
#
# The client can substitute pieces of text into the actions before it sends
# them. The most useful ones are %[myNI], which is replaced with the nickname
# of the user performing the action, and %[userNI], which is replaced with the
# nickname of the user that was selected in a user list when the command was
# run. The %[userNI] substitution does not work in the hub context, as there is
# no user selected there.
#
# You can also prompt the user for a piece of text with the substitution
# %[line:<message shown in prompt>]. If the same prompt is used multiple times
# within a command (whether in the same or different actions), the user is only
# asked once and the response is used for all instances of the prompt.
#
# For a full list of available substitutions and the contexts they work in, see
# the specification for the UCMD extension, currently available at
# http://adc.sourceforge.net/versions/ADC-EXT-1.0.6.html#_ucmd_user_commands
# Basic commands available to all users.
# These don't strictly belong in the user context, but it is often a good idea
# to put them there because the user list is a common place to right-click and
# people probably expect to see them there.
0 hub,user Show my IP
Chat 0 !myip
0 hub,user Hub uptime
Chat 0 !uptime
0 hub,user Hub version
Chat 0 !version
# Put a separator before operator commands.
4 user OpSeparator
Separator
# Kick and user info commands.
4 user Kick user
PM 0 Selected You are being kicked: %[line:Reason for kick]
Chat 1 is kicking %[userNI]: %[line:Reason for kick]
Chat 0 !kick %[userNI]
4 user Get user's IP
Chat 0 !getip %[userNI]
4 user,hub Find user with certain IP
Chat 0 !whoip %[line:Enter IP]
4 user,hub Find users within IP range
Chat 0 !whoip %[line:Enter range (can use <start>-<end> or <ip>/<mask> CIDR notation)]
# Log/broadcast commands.
4 user,hub LogSeparator
Separator
4 user,hub Show log
Chat 0 !log
4 user,hub Broadcast PM to all users
Chat 0 !broadcast %[line:Enter message to broadcast to all users]
# Admin commands.
7 user,hub AdminSeparator
Separator
7 user,hub Hub statistics
Chat 0 !stats
7 user,hub Reload configuration files
Chat 0 !reload
7 user,hub Shutdown hub
Chat 0 !shutdown
# Finish off with the help command after a separator.
0 hub,user HelpSeparator
Separator
0 hub,user Help
Chat 0 !help
# Sample configuration for a quote recording bot connected to the hub, with
# commands displayed in a sub-menu.
#
# This assumes you have reserved_sids=QuoteBot in your uhub configuration file,
# which will reserve the SID AAAB for the QuoteBot user (remember you must also
# register an account for QuoteBot for this to work). Note that if the bot is
# offline the hub will drop any message destined for the bot.
#
# NB. if you just want to see how this looks, you can uncomment the following
# lines even if you don't have such a bot - the commands will still be sent out
# to users, they just won't do anything.
#
#0 hub,user QuoteBot\Get latest quote
#PM 0 AAAB !latest
#0 hub,user QuoteBot\Get random quote
#PM 0 AAAB !random
#0 hub,user QuoteBot\Separator
#Separator
#0 hub,user QuoteBot\Add quote
#PM 0 AAAB !add %[line:Enter quote to add]
#4 hub,user QuoteBot\Delete quote
#PM 0 AAAB !delete %[line:Enter number of quote to delete]