Ejemplo n.º 1
0
        public void PostOnTeamStat(WorldCupTeam team)
        {
            var message = string.Format(TEAM_STATS, team.Country, GetCountryCode(team.Country), team.Wins, team.Draws, team.Losses, team.GoalsFor, team.GoalsAgainst);

            var slackMessage = new SlackMessage
            {
                Channel   = _channel,
                Text      = message,
                IconEmoji = Emoji.Ghost,
                Username  = "******"
            };

            _logger.Info(message);
            _api.SendMessage(_channel, message, Emoji.Ghost, "Apollo WorldCup", _logger);
        }
Ejemplo n.º 2
0
        public void PostOnEvent(WorldCupMatch match, WorldCupTeam team, WorldCupTeamEvent e)
        {
            var message = "";

            switch (e.Type)
            {
            case "red-card":
                message = string.Format(EVENT_RED_CARD, e.Player, team.Country, GetCountryCode(team.Country), e.Time);
                break;

            case "yellow-card":
                message = string.Format(EVENT_YELLOW_CARD, e.Player, team.Country, GetCountryCode(team.Country), e.Time);
                break;

            case "goal-penalty":
                message = string.Format(EVENT_PENALTY, team.Country, GetCountryCode(team.Country), e.Player, e.Time);
                break;

            case "goal":
                message = string.Format(EVENT_GOAL, e.Player, team.Country, GetCountryCode(team.Country), e.Time);
                break;

            default:
                return;
            }

            var slackMessage = new SlackMessage
            {
                Channel   = _channel,
                Text      = message,
                IconEmoji = Emoji.Ghost,
                Username  = "******"
            };

            _logger.Info(message);
            _api.SendMessage(_channel, message, Emoji.Ghost, "Apollo WorldCup", _logger);

            if (e.Type == "goal")
            {
                PostMatchStateChange(match);
            }
        }
Ejemplo n.º 3
0
        public void PostOnEvent(WorldCupTeam team, WorldCupTeamEvent e)
        {
            var message = "";

            switch (e.Type)
            {
            case "red-card":
                message = string.Format(EVENT_RED_CARD, e.Player, team.Country, GetCountryCode(team.Country), e.Time);
                break;

            case "yellow-card":
                message = string.Format(EVENT_YELLOW_CARD, e.Player, team.Country, GetCountryCode(team.Country), e.Time);
                break;

            case "goal-penalty":
                message = string.Format(EVENT_PENALTY, team.Country, GetCountryCode(team.Country), e.Player, e.Time);
                break;

            case "goal":
                message = string.Format(EVENT_GOAL, e.Player, team.Country, GetCountryCode(team.Country), e.Time);
                break;

            default:
                return;
            }

            var slackMessage = new SlackMessage
            {
                Channel   = "#sport",
                Text      = message,
                IconEmoji = Emoji.Ghost,
                Username  = "******"
            };

            Console.WriteLine(message);

            _api.SendMessage("#sport", message, Emoji.Ghost, "Apollo WorldCup");
        }