Ejemplo n.º 1
0
            async Task Responce_Connect4(string Msg, MessageEventArgs e)
            {
                var Opponent = e.Message.MentionedUsers.Where(x => x != e.User).FirstOrDefault();
                var Diff     = 50;

                try
                {
                    if (Msg.Contains('#'))
                    {
                        Diff = int.Parse(Msg.Substring(Msg.IndexOf('#') + 1));
                    }
                }
                catch (Exception)
                {
                    (await e.Channel.SendMessage(":anger: Unable to read difficulty\n`Syntax Error`")).Timed(40);
                    WriteLine("Command Error: Could not determine difficulty");
                    return;
                }
                if (Opponent == null)
                {
                    (await e.Channel.SendMessage(":anger: Could not find an opponent")).Timed(40);
                    WriteLine("Command Error: Could not determine a user");
                    return;
                }
                if (Connect4.StartNew(new User[] { e.User, Opponent }, e.Channel, Diff) == null)
                {
                    (await e.Channel.SendMessage(":anger: Specified players are currently in a game")).Timed(40);
                    WriteLine("Command Error: Users already in a game");
                    return;
                }
            }