コード例 #1
0
ファイル: Program.cs プロジェクト: nmathieu408/HeckBot
        public async Task StartAsync()
        {
            // You specify the amount of shards you'd like to have with the
            // DiscordSocketConfig. Generally, it's recommended to
            // have 1 shard per 1500-2000 guilds your bot is in.
            var config = new DiscordSocketConfig
            {
                TotalShards = TOTAL_SHARDS
            };

            // Dispose when app finishes.
            using (var services = ConfigureServices(config))
            {
                var client = services.GetRequiredService <DiscordShardedClient>();
                _shieldService = services.GetRequiredService <ShieldService>();

                // The Sharded Client does not have a Ready event.
                // The ShardReady event is used instead, allowing for individual
                // control per shard.
                client.ShardReady     += ReadyAsync;
                client.Log            += LogAsync;
                client.ShardConnected += Client_ShardConnected;

                await services.GetRequiredService <CommandHandlingService>().InitializeAsync();

                // Tokens should be considered secret data, and never hard-coded.
                await client.LoginAsync(TokenType.Bot, Environment.GetEnvironmentVariable("HECKBOT_TOKEN"));

                await client.StartAsync();

                await Task.Delay(-1);
            }
        }
コード例 #2
0
ファイル: HeckModule.cs プロジェクト: nmathieu408/HeckBot
 public HeckModule(ShieldService shieldService)
 {
     _shieldService = shieldService;
 }
コード例 #3
0
 public ElmahApiController()
 {
     _shieldService = new ShieldService();
 }