-
Notifications
You must be signed in to change notification settings - Fork 6
Modules
Valerie Pond edited this page May 22, 2022
·
2 revisions
Modules are written in PHP, and should be kept somewhere in the src/modules/
directory.
You can load a module from the suitable configuration, or even inside of your code.
For example, if your module file is called ns_example.php
and kept in src/modules/NickServ/
, then you can use:
loadmodule("NickServ/ns_example");
Any module which is located directly inside the /modules/
directory can be loaded like:
loadmodule("example");
During runtime, you can load or unload a module by messaging OperServ:
/msg OperServ UNLOADMOD NickServ/ns_ajoin
/msg OperServ LOADMOD NickServ/ns_ajoin
Interested in coding a module? Great! Here are a few important tips to help you get started.
- The module name must be the same throughout. That is to mean, the file name must match both the class name within the file and the
public $name
within that class must also match. - When using executing a built-in function which registers module data, such as spawning a new pseudo-client or adding a new command, you shouldn't execute it from your
__construct()
method, and instead you should execute it from your__init()
method. This is because during the time of__construct
ion, the module has not been registered yet, and so cannot assign data about it yet.