Esempio n. 1
0
 private void OnInitComplete(CakeStartedEvent e)
 {
     if (CommandsExtensionServices.IsAvailable())
     {
         this.LoadCommands();
     }
 }
Esempio n. 2
0
 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);
 }
Esempio n. 3
0
        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
            }
        }