private void OnInitComplete(CakeStartedEvent e) { if (CommandsExtensionServices.IsAvailable()) { this.LoadCommands(); } }
public CakeSetup ListenToConsole() { this._actions += bot => { if (!CommandsExtensionServices.IsAvailable() || !this.ListenToConsoleInternal(bot)) { throw new InvalidOperationException("You must first load CommandsExtension before calling ListenToConsole!"); } }; return(this); }
protected BotBase() { this._botBits = CakeServices.Client; if (this._botBits == null) { throw new InvalidOperationException( "Please call CakeServices.WithClient before creating new BotBase objects."); } if (CakeServices.Starting) { CakeStartedEvent.Of(this._botBits).Bind(this.OnInitComplete); } this.EventLoader.Load(this); if (CommandsExtensionServices.IsAvailable()) { this.LoadCommands(); // Try to load commands as soon as possible } }