public static async Task Login(string email, string password) { DiscordApiConfiguration config = new DiscordApiConfiguration { BaseUrl = "https://discordapp.com/api" }; BasicRestFactory basicRestFactory = new BasicRestFactory(config); ILoginService loginService = basicRestFactory.GetLoginService(); LoginRequest.Email = email; LoginRequest.Password = password; Loginresult = await loginService.Login(LoginRequest); Token = Loginresult.Token; IAuthenticator authenticator = new DiscordAuthenticator(Token); AuthenticatedRestFactory = new AuthenticatedRestFactory(config, authenticator); IGatewayConfigService gatewayService = basicRestFactory.GetGatewayConfigService(); SharedModels.GatewayConfig gateconfig = await gatewayService.GetGatewayConfig(); Gateway = new Gateway.Gateway(gateconfig, authenticator); }
public static async Task AutoLogin() { config = new DiscordApiConfiguration { BaseUrl = "https://discordapp.com/api" }; Token = Storage.Token; BasicRestFactory basicRestFactory = new BasicRestFactory(config); IAuthenticator authenticator = new DiscordAuthenticator(Token); AuthenticatedRestFactory = new AuthenticatedRestFactory(config, authenticator); IGatewayConfigService gatewayService = basicRestFactory.GetGatewayConfigService(); SharedModels.GatewayConfig gateconfig = await gatewayService.GetGatewayConfig(); Gateway = new Gateway.Gateway(gateconfig, authenticator); }