public RainService(ILoggerFactory loggerFactory, DiscordSocketClient discord, WalletService walletService, ConfigModule config) { _logger = loggerFactory.CreateLogger("rain"); _discord = discord; _walletService = walletService; _config = config; _random = new Random(); TimeSpan TimspanConverter(object value) => TimeSpan.FromSeconds(Convert.ToDouble(value)); _checkInterval.Converter = TimspanConverter; _announceDelay.Converter = TimspanConverter; _registerDelay.Converter = TimspanConverter; _checkCanellationTokenSource = new CancellationTokenSource(); _wallets = new ConcurrentDictionary <SocketUser, TurtleWallet>(); _requiredReactions = new ConcurrentDictionary <ulong, Emote>(); _guildId = 388915017187328002; _channelId = Convert.ToUInt64(config["rainChannelId"]); // The rain service has to be started explicitly (with ``!rain start``) State = RainServiceState.Stopped; config.AddBinding(_balanceThreshold, "threshold"); config.AddBinding(_checkInterval, "check"); config.AddBinding(_announceDelay, "announce"); config.AddBinding(_registerDelay, "register"); _discord.MessageReceived += MessageReceived; }
public WalletService(ILoggerFactory loggerFactory, ConfigModule config) { _logger = loggerFactory.CreateLogger("wallet"); _client = new HttpClient(); _walletEndpoint = $"http://{config["walletdServiceAddress"]}:{config["walletdServicePort"]}/json_rpc"; _rpcPassword = config["walletdRPCPassword"]; _requestId = 0; }