Пример #1
0
        public static void DrawProposal(GameProposal proposal)
        {
            var builder = proposal.Drawer.Builder;

            builder.Fields.Clear();
            builder.Color = Color.Magenta;
            builder.Title = $"{proposal.Creator.Username} started a Chext Proposal";
            builder.AddField($"***{NameOrEmpty(proposal.WhiteSide)}*** vs ***{NameOrEmpty(proposal.BlackSide)}***", "White vs Black");
            builder.Footer = new EmbedFooterBuilder {
                Text = "type \"join\" or \"join white/black\" to participate in game"
            };

            proposal.Drawer.Draw();

            string NameOrEmpty(SocketUser?user) => (user == null) ? "(empty)" : user.Username;
        }
Пример #2
0
        public void OnGameProposalProposal(ISocketMessageChannel channel, SocketUser creator)
        {
            if (_proposals.ContainsKey(channel.Id))
            {
                Program.WarningLog("Cannot create proposal when one already exists in same channel!");
                return;
            }

            if (_games.ContainsKey(channel.Id))
            {
                Program.WarningLog("Cannot create proposal when an active game already exists in same channel!");
                return;
            }

            Program.DebugLog($"New Game Proposal at {channel.Name}");
            var newProposal = new GameProposal(creator, channel, new EmbededDrawer(channel));

            _proposals.Add(channel.Id, newProposal);
            GameManagerRenderer.DrawProposal(newProposal);
        }