예제 #1
0
    [AllowedRoles(Role.Developer)] // TODO: Change to any guild member
    public async Task GetProfileCardAsync()
    {
        await DeferAsync();

        try
        {
            await using var imageStream = await _imageProvider.CreateProfileImage((DiscordUserId) Context.User.Id,
                                                                                  Context.User.GetAvatarUrl(ImageFormat.Png));

            await Context.Interaction.FollowupWithFileAsync(imageStream,
                                                            $"{Context.User.Discriminator}_{DateTime.UtcNow:yyyyMMddHHmmss}.png");
        }
        catch (Exception e)
        {
            _logger.LogError(e, "Failed to create UNITS profile card image.");
            await FollowupAsync("Failed to create image.");
        }
    }