Exemple #1
0
 public CaptchaService(IServiceProvider services)
 {
     _discord                  = services.GetRequiredService <DiscordSocketClient>();
     _game                     = services.GetRequiredService <GameService>();
     _services                 = services;
     _achievements             = services.GetRequiredService <AchievementService>();
     _discord.MessageReceived += MessageReceivedAsync;
 }
Exemple #2
0
        public CommandHandlingService(IServiceProvider services)
        {
            _commands     = services.GetRequiredService <CommandService>();
            _discord      = services.GetRequiredService <DiscordSocketClient>();
            _achievements = services.GetRequiredService <AchievementService>();
            _rand         = services.GetRequiredService <Random>();

            _services = services;
            // Hook CommandExecuted to handle post-command-execution logic.
            _commands.CommandExecuted += CommandExecutedAsync;
            // Hook MessageReceived so we can process each message to see
            // if it qualifies as a command.
            _discord.MessageReceived += MessageReceivedAsync;
        }