Esempio n. 1
0
        public async Task AddReserve(int slots = 0)
        {
            if (SignupsData.Missions.Any(x => x.Editing == Mission.EditEnum.New && x.Owner == Context.User.Id))
            {
                var mission = SignupsData.Missions.Single(x => x.Editing == Mission.EditEnum.New && x.Owner == Context.User.Id);
                // SL
                var team = new Mission.Team();
                team.Slots.Add(new Mission.Team.Slot(
                                   "Rezerwa",
                                   "馃殤",
                                   slots));
                team.Pattern = $"Rezerwa 馃殤 [{slots}]";
                mission.Teams.Add(team);

                await ReplyAsync("Jeszcze co艣?");
            }
            else
            {
                await ReplyAsync("A ta rezerwa to do czego?");
            }
        }
Esempio n. 2
0
        public async Task AddTeam(string teamName, int teamSize = 6)
        {
            if (SignupsData.Missions.Any(x => x.Editing == Mission.EditEnum.New && x.Owner == Context.User.Id))
            {
                var mission = SignupsData.Missions.Single(x => x.Editing == Mission.EditEnum.New && x.Owner == Context.User.Id);
                // SL
                var team = new Mission.Team();
                team.Name = teamName + " SL | <:wsciekly_zulu:426139721001992193> [1] | 馃殤 [1]";
                var slot = new Mission.Team.Slot(
                    "Dow贸dca",
                    "<:wsciekly_zulu:426139721001992193>",
                    1);
                team.Slots.Add(slot);

                slot = new Mission.Team.Slot(
                    "Medyk",
                    "馃殤",
                    1);
                team.Slots.Add(slot);
                team.Pattern = "<:wsciekly_zulu:426139721001992193> [1] | 馃殤 [1]";
                mission.Teams.Add(team);

                // team 1
                team      = new Mission.Team();
                team.Name = teamName + " 1 | <:wsciekly_zulu:426139721001992193> [1] | 馃殤 [1] | <:beton:437603383373987853> [" + (teamSize - 2) + "]";
                slot      = new Mission.Team.Slot(
                    "Dow贸dca",
                    "<:wsciekly_zulu:426139721001992193>",
                    1);
                team.Slots.Add(slot);

                slot = new Mission.Team.Slot(
                    "Medyk",
                    "馃殤",
                    1);
                team.Slots.Add(slot);

                slot = new Mission.Team.Slot(
                    "BPP",
                    "<:beton:437603383373987853>",
                    teamSize - 2);
                team.Slots.Add(slot);
                team.Pattern = "<:wsciekly_zulu:426139721001992193> [1] | 馃殤 [1] | <:beton:437603383373987853> [" + (teamSize - 2) + "]";
                mission.Teams.Add(team);

                // team 2
                team      = new Mission.Team();
                team.Name = teamName + " 2 | <:wsciekly_zulu:426139721001992193> [1] | 馃殤 [1] | <:beton:437603383373987853> [" + (teamSize - 2) + "]";
                slot      = new Mission.Team.Slot(
                    "Dow贸dca",
                    "<:wsciekly_zulu:426139721001992193>",
                    1);
                team.Slots.Add(slot);

                slot = new Mission.Team.Slot(
                    "Medyk",
                    "馃殤",
                    1);
                team.Slots.Add(slot);

                slot = new Mission.Team.Slot(
                    "BPP",
                    "<:beton:437603383373987853>",
                    teamSize - 2);
                team.Slots.Add(slot);
                team.Pattern = "<:wsciekly_zulu:426139721001992193> [1] | 馃殤 [1] | <:beton:437603383373987853> [" + (teamSize - 2) + "]";
                mission.Teams.Add(team);

                await ReplyAsync("Jeszcze co艣?");
            }
            else
            {
                await ReplyAsync("A mo偶e by艣 mi najpierw powiedzia艂 do jakiej misji chcesz doda膰 ten zesp贸艂?");
            }
        }
Esempio n. 3
0
        public async Task AddTeam([Remainder] string teamText)
        {
            if (SignupsData.Missions.Any(x => x.Editing == Mission.EditEnum.New && x.Owner == Context.User.Id))
            {
                var mission = SignupsData.Missions.Single(x => x.Editing == Mission.EditEnum.New && x.Owner == Context.User.Id);

                var slotTexts = teamText.Split("|");

                if (slotTexts.Length > 1)
                {
                    var team = new Mission.Team();
                    team.Name    = slotTexts[0];
                    team.Pattern = "";

                    foreach (var slotText in slotTexts)
                    {
                        MatchCollection matches = MiscHelper.GetSlotMatchesFromText(slotText);
                        if (matches.Count == 0)
                        {
                            continue;
                        }

                        Match match = matches.First();

                        if (match.Success)
                        {
                            var slot = new Mission.Team.Slot(match.Groups[1].Value, int.Parse(match.Groups[2].Value.Substring(1, match.Groups[2].Value.Length - 2)));
                            if (match.Groups.Count == 4)
                            {
                                slot.Name = match.Groups[3].Value;
                                foreach (var user in Context.Message.MentionedUsers)
                                {
                                    if (slot.Name.Contains(user.Mention))
                                    {
                                        slot.Name = slot.Name.Replace(user.Mention, "");
                                        slot.Signed.Add(user.Id);
                                    }
                                }
                            }
                            team.Slots.Add(slot);

                            if (team.Pattern.Length > 0)
                            {
                                team.Pattern += "| ";
                            }
                            team.Pattern += $"{slot.Emoji} [{slot.Count}] {slot.Name} ";
                        }
                    }

                    if (team.Slots
                        .GroupBy(x => x.Emoji)
                        .Any(x => x.Count() > 1))
                    {
                        await ReplyAsync("Zdublowa艂e艣 reakcje. Poprawiaj to!");

                        return;
                    }

                    var embed = new EmbedBuilder()
                                .WithColor(Color.Green)
                                .WithTitle(team.Name)
                                .WithDescription(_miscHelper.BuildTeamSlots(team)[0])
                                .WithFooter(team.Pattern);

                    _miscHelper.CreateConfirmationDialog(
                        _dialogs,
                        Context,
                        embed.Build(),
                        dialog =>
                    {
                        Context.Channel.DeleteMessageAsync(dialog.DialogID);
                        _dialogs.Dialogs.Remove(dialog);
                        mission.Teams.Add(team);
                        foreach (var slot in team.Slots)
                        {
                            foreach (var signed in slot.Signed)
                            {
                                mission.SignedUsers.Add(signed);
                            }
                        }
                        ReplyAsync("OK!");
                    },
                        dialog =>
                    {
                        Context.Channel.DeleteMessageAsync(dialog.DialogID);
                        _dialogs.Dialogs.Remove(dialog);
                        ReplyAsync("OK Boomer");
                    });
                }
            }
            else
            {
                await ReplyAsync("A mo偶e by艣 mi najpierw powiedzia艂 do jakiej misji chcesz doda膰 ten zesp贸艂?");
            }
        }