public async Task <bool> TestKahlaLive(string server) { try { _botLogger.LogInfo($"Using Kahla Server: {_kahlaLocation}"); _botLogger.LogInfo("Testing Kahla server connection..."); var index = await _homeService.IndexAsync(server); _botLogger.AppendResult(true, 5); //_botLogger.LogSuccess("Success! Your bot is successfully connected with Kahla!\r\n"); _botLogger.LogInfo($"Server time: \t{index.UTCTime}\tServer version: \t{index.APIVersion}"); _botLogger.LogInfo($"Local time: \t{DateTime.UtcNow}\tLocal version: \t\t{_versionService.GetSDKVersion()}"); if (index.APIVersion != _versionService.GetSDKVersion()) { _botLogger.AppendResult(false); _botLogger.LogDanger("API version don't match! Kahla bot may crash! We strongly suggest checking the API version first!"); } else { _botLogger.AppendResult(true); } return(true); } catch (Exception e) { _botLogger.LogDanger(e.Message); return(false); } }
public async Task SignIn(int code) { while (true) { try { _botLogger.LogInfo("Calling sign in API..."); var response = await _authService.SignIn(code); if (!string.IsNullOrWhiteSpace(response)) { _botLogger.AppendResult(true, 7); break; } } catch (WebException) { _botLogger.AppendResult(false, 7); _botLogger.LogDanger("Invalid code!"); code = await AskCode(); } } }