users are now renamed after joining the discord server
This commit is contained in:
parent
601bd10c39
commit
17d8983fb0
4 changed files with 74 additions and 0 deletions
|
@ -171,5 +171,21 @@ namespace DiscordBot.Services
|
|||
}
|
||||
return new List<ulong>();
|
||||
}
|
||||
|
||||
public async Task<ApiRaid.Role.User> GetUser(ulong userId)
|
||||
{
|
||||
var httpClient = _httpClientFactory.CreateClient(Constants.HTTP_CLIENT_NAME);
|
||||
|
||||
var httpResponseMessage = await httpClient.GetAsync($"DiscordBot/GetUser/{userId}");
|
||||
|
||||
if (httpResponseMessage.IsSuccessStatusCode)
|
||||
{
|
||||
using var contentStream =
|
||||
await httpResponseMessage.Content.ReadAsStreamAsync();
|
||||
|
||||
return await JsonSerializer.DeserializeAsync<ApiRaid.Role.User>(contentStream, _serializerOptions);
|
||||
}
|
||||
return new ApiRaid.Role.User();
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue