Base Extension
Base extensions for the Bot Viewer get called as soon as the user connects to the bot's server.
PluginCore.cs
Events
As can be seen from the example code, there are two types of bot viewer based events: FromClient, which are events that get triggered by the client attempting to send data to the server, and ToClient, which are events that get triggered when the server is attempting to send data to the client.
Each of these events can be cancelled, which means it would never reach the desired destination (e.g.: cancel a ChatMessage event so a chat message is never actually sent to the server). This can be done by calling the token.Cancel() function, where the token variable is a pararemeter of each event.
Sending Data to Client
Data can be sent to the client through the Client variable, which should be accessed in the following way: this.Client, as can be seen in the example code. This class has functions that allow you to send data to the client, such as SendChat, which would send a chat message to che connected client.
To send data to the server you can still use the Context variable, which is heavilly documented in the API section of the docs.
Last updated