Esempio n. 1
0
        private async Task SendRecentRecords(IMessageChannel channel)
        {
            var recentRecords = await _simplyDataAccess.GetRecentRecords(10);

            var recentRecordsString = recentRecords.Aggregate("",
                                                              (currentString, nextHighscore) => currentString +
                                                              $"{ClassConstants.ToString(nextHighscore.Class)} **#{nextHighscore.Position + 1}** on **{nextHighscore.Map}** in **__{nextHighscore.GetTimeSpan:c}__** run by **{nextHighscore.Name}**" +
                                                              Environment.NewLine);

            var builder = new EmbedBuilder {
                Title = "**Recent Map Records**"
            };

            builder.WithDescription(recentRecordsString)
            .WithFooter("Updated " + DateTime.Now.ToShortTimeString());
            await channel.SendMessageAsync("", embed : builder);
        }
Esempio n. 2
0
        /// <summary>
        /// Convenience method that gets a list of all Locations that are active
        /// </summary>
        /// <param name="authToken">AuthorizationToken to use</param>
        /// <returns></returns>
        public static async Task <List <Location> > GetAll(AuthorizationToken authToken)
        {
            PropertyPathHelper pathHelper = new PropertyPathHelper();

            pathHelper.PropertyName = "ObjectStatus";
            pathHelper.ObjectClass  = ClassConstants.GetClassIdByType <Location>();

            QueryCriteriaExpression expr = new QueryCriteriaExpression
            {
                PropertyName = pathHelper.ToString(),
                PropertyType = QueryCriteriaPropertyType.Property,
                Operator     = QueryCriteriaExpressionOperator.Equal,
                Value        = EnumerationConstants.ConfigItem.BuiltinValues.ObjectStatus.Active.ToString("D")
            };

            QueryCriteria criteria = new QueryCriteria(TypeProjectionConstants.Location.Id)
            {
                GroupingOperator = QueryCriteriaGroupingOperator.SimpleExpression
            };

            criteria.Expressions.Add(expr);

            return(await GetByCriteria(authToken, criteria));
        }
Esempio n. 3
0
        private async Task SendRecentPersonalBests(IMessageChannel channel)
        {
            // TODO: Rename these
            var recentPersonalBest = await _simplyDataAccess.GetRecentPersonalBests(15);

            var recentRecordsString = recentPersonalBest.Aggregate("",
                                                                   (currentString, nextHighscore) => currentString +
                                                                   $"**{nextHighscore.Name}** got a **{ClassConstants.ToString(nextHighscore.Class)}** personal best of **{nextHighscore.GetTimeSpan:c}** on **{nextHighscore.Map}**" +
                                                                   Environment.NewLine);

            var builder = new EmbedBuilder {
                Title = "**Recent Personal Bests**"
            };

            builder.WithDescription(recentRecordsString)
            .WithFooter("Updated " + DateTime.Now.ToShortTimeString());
            await channel.SendMessageAsync("", embed : builder);
        }