3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-12-28 13:42:37 +01:00

writing-plugins: refer to the services API guide for utils.add_cmd features

This commit is contained in:
James Lu 2018-07-02 00:47:30 -07:00
parent b2e85fa385
commit a74fe9bf08

View File

@ -41,7 +41,8 @@ Commands are registered by calling `utils.add_cmd()` with one or two arguments.
- `utils.add_cmd(testcommand, "hello")` registers a function named `testcommand` as the command handler for `hello` (i.e. `/msg PyLink hello`)
- `utils.add_cmd(testcommand)` registers a function named `testcommand` as the command handler for `testcommand`.
Decorator syntax (`@utils.add_cmd`) can also be used for the second case.
`utils.add_cmd(...)` also takes some keyword arguments, described in the [services API guide](services-api.md#service-bots-and-commands) (replace `myservice.add_cmd` with `utils.add_cmd`). Decorator syntax (`@utils.add_cmd`) can also be used for the second example above.
Each command handler function takes 3 arguments: `irc, source, args`.
- **irc**: The network object where the command was called.