flex sign up in the bot is now also only possible if the user is already signed up

This commit is contained in:
Sarah Faey 2022-12-03 14:01:25 +01:00
parent 19595e52bf
commit 766faf7b66
3 changed files with 37 additions and 3 deletions

View file

@ -67,6 +67,22 @@ namespace DiscordBot.Services
return new Tuple<bool, string>(true, string.Empty);
}
public async Task<bool> IsUserSignedUp(int raidId, ulong userId)
{
var httpClient = _httpClientFactory.CreateClient(Constants.HTTP_CLIENT_NAME);
var httpResponseMessage = await httpClient.GetAsync($"DiscordBot/IsUserSignedUp/{raidId}/{userId}");
if (httpResponseMessage.IsSuccessStatusCode)
{
using var contentStream =
await httpResponseMessage.Content.ReadAsStreamAsync();
return await JsonSerializer.DeserializeAsync<bool>(contentStream, _serializerOptions);
}
return false;
}
public async Task<List<ApiRole>> GetRoles(int raidId, ulong userId)
{
var httpClient = _httpClientFactory.CreateClient(Constants.HTTP_CLIENT_NAME);