Botting Command Additions
Plugins can also add custom commands to the botting tab. Regular plugin api functions can be used within the Activate method. This page describes how to make a plugin that registers new commands.
PluginCore.cs
1
[Plugin(1, "Extra Botting Command Plugin", "Adds new command to the botting tab!")]
2
public class PluginCore : IStartPlugin
3
{
4
/// <summary>
5
/// Should be used to check compatability with the
6
/// current version of the bot.
7
/// </summary>
8
public override void OnLoad(int version, int subversion, int buildversion) { }
9
public override PluginResponse OnEnable(IBotSettings botSettings) {
10
/* Regular plugin content */
11
return base.OnEnable(botSettings);
12
}
13
}
14
15
public class TestCommand : IExternalCommand {
16
public override string Name => "Test Command 1";
17
public override string Description => "This is a description for the command.";
18
19
public TestCommand() {
20
this.Variables = new ICommandVariableCollection(
21
new ExternalCommandVariable(typeof(string), "internal_variable_name", "Text to print", "What message should we send to the chat?", "This is a default message")
22
);
23
}
24
25
public override CommandResponse Activate(IBotContext Context, ICommandVariables arguments, IStopToken token) {
26
Context.Functions.Chat("Hello, my message is: " + arguments.Get<string>("internal_variable_name"));
27
return new CommandResponse(); // no parameters means success=true
28
}
29
}
Copied!
Copy link