public CommandHandlerService(IServiceProvider services, PickupBotSettings pickupBotSettings, ILogger <CommandHandlerService> logger) { ServiceLocator.SetLocatorProvider(services); _commands = services.GetRequiredService <CommandService>(); _discord = services.GetRequiredService <DiscordSocketClient>(); _translationService = services.GetService <ITranslationService>(); _services = services; _logger = logger; _commandPrefix = pickupBotSettings.CommandPrefix ?? "!"; _rconPassword = pickupBotSettings.RCONServerPassword ?? ""; _rconHost = pickupBotSettings.RCONHost ?? ""; int.TryParse(pickupBotSettings.RCONPort ?? "0", out _rconPort); // 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; _discord.ReactionAdded += ReactionAddedAsync; //if (_commandPrefix == "!") //{ // GetActivityStats().GetAwaiter().GetResult(); // UpdateActvity(); //} }
public PickupMiscModule(PickupBotSettings pickupBotSettings, EncryptionSettings encryptionSettings, ILogger <PickupMiscModule> logger, IServerRepository serverRepository) { _encryptionSettings = encryptionSettings; _logger = logger; _serverRepository = serverRepository; _rconPassword = pickupBotSettings.RCONServerPassword ?? ""; _rconHost = pickupBotSettings.RCONHost ?? ""; int.TryParse(pickupBotSettings.RCONPort ?? "0", out _rconPort); }
public CommandHandlerService( DiscordSocketClient client, IServiceProvider services, PickupBotSettings pickupBotSettings, ILogger <CommandHandlerService> logger, CommandService commands ) : base(client, logger) { ServiceLocator.SetLocatorProvider(services); _commands = commands; _discord = client; _translationService = services.GetService <ITranslationService>(); _services = services; _logger = logger; _commandPrefix = pickupBotSettings.CommandPrefix ?? "!"; _rconPassword = pickupBotSettings.RCONServerPassword ?? ""; _rconHost = pickupBotSettings.RCONHost ?? ""; _ = int.TryParse(pickupBotSettings.RCONPort ?? "0", out _rconPort); }
public GoogleTranslationService(PickupBotSettings pickupBotSettings, IMapper mapper, ILogger <GoogleTranslationService> logger) { _mapper = mapper; _logger = logger; _googleTranslateApiKey = pickupBotSettings.GoogleTranslateAPIKey ?? ""; }