Ejemplo n.º 1
0
            public async Task ConvertList(IUserMessage msg)
            {
                var sb  = new StringBuilder("Units that can be used by the converter: \n");
                var res = Units.GroupBy(x => x.UnitType);

                foreach (var group in res)
                {
                    sb.AppendLine($"{group.Key}: ```xl");
                    sb.AppendLine(string.Join(",", group.Select(x => x.Triggers.FirstOrDefault()).OrderBy(x => x)));
                    sb.AppendLine("```");
                }
                await msg.ReplyLong(sb.ToString(), breakOn : new[] { "```xl\n", "\n" });
            }
Ejemplo n.º 2
0
 public async Task CalcOps(IUserMessage msg)
 {
     StringBuilder builder = new StringBuilder();
     var selection = typeof(Math).GetTypeInfo().GetMethods().Except(typeof(object).GetTypeInfo().GetMethods()).Select(x =>
     {
         var name = x.Name;
         if (x.GetParameters().Any())
         {
             name += " (" + string.Join(", ", x.GetParameters().Select(y => y.IsOptional ? $"[{y.ParameterType.Name + " " + y.Name }]" : y.ParameterType.Name + " " + y.Name)) + ")";
         }
         return name;
     });
     foreach (var method in selection) builder.AppendLine(method);
     await msg.ReplyLong(builder.ToString());
 }
Ejemplo n.º 3
0
        public async Task CalcOps(IUserMessage msg)
        {
            StringBuilder builder   = new StringBuilder();
            var           selection = typeof(Math).GetTypeInfo().GetMethods().Except(typeof(object).GetTypeInfo().GetMethods()).Select(x =>
            {
                var name = x.Name;
                if (x.GetParameters().Any())
                {
                    name += " (" + string.Join(", ", x.GetParameters().Select(y => y.IsOptional ? $"[{y.ParameterType.Name + " " + y.Name }]" : y.ParameterType.Name + " " + y.Name)) + ")";
                }
                return(name);
            });

            foreach (var method in selection)
            {
                builder.AppendLine(method);
            }
            await msg.ReplyLong(builder.ToString());
        }
Ejemplo n.º 4
0
 public async Task ConvertList(IUserMessage msg)
 {
     var sb = new StringBuilder("Units that can be used by the converter: \n");
     var res = Units.GroupBy(x => x.UnitType);
     foreach (var group in res)
     {
         sb.AppendLine($"{group.Key}: ```xl");
         sb.AppendLine(string.Join(",", group.Select(x => x.Triggers.FirstOrDefault()).OrderBy(x => x)));
         sb.AppendLine("```");
     }
     await msg.ReplyLong(sb.ToString(),  breakOn: new[] { "```xl\n", "\n" });
 }