Ejemplo n.º 1
0
        public async Task Test()
        {
            var players = await _warcraftLogsService.GetFullFight("1J3rRY6L7Ng4zAyv");

            foreach (var player in players.Friendlies)
            {
                await Context.Channel.SendMessageAsync($"{player.Name} {player.Server} {player.Type}");
            }
        }
Ejemplo n.º 2
0
        public async Task CountFlasks(string fightId, int count)
        {
            var data = await _warcraftLogsService.GetFullFight(fightId);

            if (data != null)
            {
                var fightDateTime = new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc);
                fightDateTime = fightDateTime.AddMilliseconds(data.Start).ToLocalTime();

                SubstractFlasks(data.Friendlies, count, fightDateTime);
                AddReaction(fightId);

                var counter = 1;
                var sb      = new StringBuilder();
                foreach (var friendly in data.Friendlies)
                {
                    sb.AppendLine($"{counter++}. {friendly.Name.Decorate(Decorator.Bold)}  ({friendly.Type.Decorate(Decorator.Italics)})");
                }

                sb.AppendLine(string.Empty);
                sb.AppendLine($"Odejmuje {count.ToString().Decorate(Decorator.Bold)} {count.FlaskGrammaVariety()}");

                foreach (var msg in sb.ToString().DiscordMessageSplit())
                {
                    await Context.Channel.SendMessageAsync(msg);
                }

                var nick = _discordContext.GetUserNickname(Context.User.Id);
                await _discordContext.GetChannel(_config.CurrentValue.FlaskChannelId).SendMessageAsync($"Podliczono raid z {fightDateTime.ToString("yyyy-MM-dd".Decorate(Decorator.Bold))} przez użytkownika {nick.Decorate(Decorator.Bold)}");
            }
            else
            {
                await _logger.WriteLog($"Logs {fightId} doesn't exist");

                await Context.Channel.SendMessageAsync($"Logi o Id {fightId} nie istnieją!");
            }
        }