示例#1
0
        private async Task ProcessWhales(List <string> args)
        {
            var numWhales = 5;

            if (args.Count >= 2 || args.Count == 1 && !int.TryParse(args[0], out numWhales))
            {
                await _messageService.SendMessage(_event.Message.ChannelId, new OutgoingMessage
                {
                    Content = "Incorrect command format: !plog whales [numWhales?]"
                });

                return;
            }

            var topWhales = await _powerService.GetWhales(numWhales);

            var fields = new List <EmbedField>();

            for (var i = 0; i < topWhales.Count; i++)
            {
                var whale = topWhales[i];
                fields.Add(new EmbedField
                {
                    Name  = $"{_bladeAndSoulService.GetClassEmojiByClass(whale.CharacterClass)} {whale.Name}",
                    Value = $"#{i + 1} whale with a score of {whale.Score}\n\n\n\n\n"
                });
            }

            var embed = new Embed
            {
                Title     = "Ploggystyle Whales",
                Timestamp = DateTime.UtcNow,
                Color     = HexConstants.Green,
                //Thumbnail = new EmbedItem
                //{
                //    Url = main.ImageUrl
                //},
                //Author = new EmbedItem
                //{
                //    Name = main.RealName,
                //    Url = $"http://na-bns.ncsoft.com/ingame/bs/character/profile?c={HttpUtility.UrlEncode(main.Name)}",
                //    IconUrl = user.Avatar
                //},
                Footer = new EmbedItem
                {
                    IconUrl = EmojiConstants.PlogUrl,
                    Text    = "PlogBot"
                },
                Fields = fields
            };

            await _messageService.SendMessage(_event.Message.ChannelId, new OutgoingMessage
            {
                Content = "Whales",
                Embed   = embed
            });
        }