コード例 #1
0
        public async Task GetDetailedParticipant(string discordId)
        {
            using (Context.Channel.EnterTypingState())
            {
                try
                {
                    _logger.LogInformation($"Executing get {discordId}");

                    var participant =
                        await _participantService.GetParticipantOrDefault(Context.Guild.Id.ToString(), discordId);

                    if (participant == null)
                    {
                        await ReplyAsync(embed : _embedBuilderService.BuildSimpleEmbed(
                                             "Not Found",
                                             "Couldn't find participant with this discord id")
                                         );

                        return;
                    }

                    var athlete = await _stravaService.GetAthlete(participant);

                    foreach (var embed in _embedBuilderService.BuildDetailedAthleteEmbeds(participant, athlete))
                    {
                        await ReplyAsync(embed : embed);
                    }
                }
                catch (Exception e)
                {
                    _logger.LogError(e, "list failed");
                }
            }
        }
コード例 #2
0
        public async Task GetDetailedParticipant()
        {
            var id = Context.User.Id.ToString();

            using (Context.Channel.EnterTypingState())
            {
                try
                {
                    foreach (var embed in await BuildProfileEmbedsForStravaOrDiscordId(id))
                    {
                        await ReplyAsync(embed : embed);
                    }
                }
                catch (Exception e)
                {
                    _logger.LogError(e, "get failed");
                    await ReplyAsync(embed : _embedBuilderService.BuildSimpleEmbed(
                                         "Not Found",
                                         "Couldn't find participant with given parameters")
                                     );
                }
            }
        }