Ejemplo n.º 1
0
        static async Task Main()
        {
            BotStartTime = DateTimeOffset.UtcNow;
            var cfg = new Configuration();

            await Database.DoInitialDatabaseSetupAsync();

            Console.CancelKeyPress += OnCancelKeyPressed;
            _bot = new ShardManager(cfg);

            await Task.Delay(-1);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Prepares and configures the shard instances, but does not yet start its connection.
        /// </summary>
        public ShardInstance(ShardManager manager, DiscordSocketClient client, Dictionary <string, CommandHandler> commands)
        {
            _manager          = manager;
            _dispatchCommands = commands;

            DiscordClient                  = client;
            DiscordClient.Log             += Client_Log;
            DiscordClient.Ready           += Client_Ready;
            DiscordClient.MessageReceived += Client_MessageReceived;

            // Background task constructor begins background processing immediately.
            _background = new ShardBackgroundWorker(this);
            DiscordClient.Disconnected += Client_Disconnected;
        }