vylbot-app/docs/Registry.md
Vylpes 1b1a070cfd
Feature/66 add different commands per server (#122)
* Add ability for server exclusive commands

* Add MankBot server-exclusive commands

* Add lobby entity to database

* Add documentation
2022-04-09 14:11:06 +01:00

931 B

Registry

The registry file is what is used to register the bot's commands and events. This is a script which is ran at startup and adds all the commands and events to the bot.

Although you can register these outside of the registry file, this script makes it a centralised place for it to be done at.

Adding Commands

Commands are added in the RegisterCommands function.

The basic syntax is as follows:

client.RegisterCommand("Name", new Command(), "ServerId");
  • "Name": The name of the command, will be used by the user to call the command
  • new Command(): The command class to be executed, must inherit the Command class
  • "ServerId" (Optional): If given, will only be usable in that specific server

Adding Events

Events are added in the RegisterEvents function.

The basic syntax is as follows:

client.RegisterEvent(new Events());
  • new Events(): The event class to be executed