Dynamic Alias Plugin

This plugin adds a way of creating aliases for other commands.

This plugin depends upon the admin plugin.

The database is a Dirty db, choosen because it requires no binary parts or starting a remote server. If you want to use something else, the plugin could be changed to accomodate. File an issue.

The bot will intercept commands, and when it sees a command that matches an added alias, will replace the command with what it aliases to.

Configuration

dynamic-alias-database-location
Required String. A relative path from the current working directory to the location of the factoids database. Will use an in-memory database if an empty string is given.

Command: !dynamic-alias

This plugin adds one command `!dynamic-alias` with subcommands for specific functionality. You must be an admin to use this command.

!dynamic-alias view <alias-name>

Show the runtime information on the specified alias.

!dynamic-alias set <alias-name> <command-name> [<command-args>+]

Set (or reset) a new alias.

Command args can include $n in which case it will be replaced by the nth argument (starting at 0) to the alias. Likewise for $n+ except that it replaces with all args from the nth forwards. If there is no nth command, it will sputter "Incorrect number of arguments given..

!dynamic-alias remove <alias-name>

Removes the alias.

Example Usage

For these examples, we are going to assume we have !say from the control plugin. The admin is named admin, there's another user named user, and the bot is named bot. They are in the channel #here.

Basic example

[admin] !dynamic-alias set say-hi-here say #here Hi.
  [bot] Done.
[admin] !say-hi-here
  [bot] Hi.

Using $n

[admin] !dynamic-alias set hello say #here Hello $0
  [bot] Done.
[admin] !hello user
  [bot] Hello user
[admin] !hello world
  [bot] Hello world
[admin] !hello
  [bot] Incorrect number of arguments given.

Using $n+

[admin] !dynamic-alias set hello say #here Hello $0+
  [bot] Done.
[admin] !hello user
  [bot] Hello user
[admin] !hello everybody and their pets
  [bot] Hello everybody and their pets
[admin] !hello
  [bot] Incorrect number of arguments given.

Aliases have same command restrictions as if user tried normal command

[admin] !dynamic-alias set hello say #here Hi.
  [bot] Done.
 [user] !hello
  [bot] Permission denied.

Because !say is an admin-only command, only an admin can call !hello.

Source

GitHub