Ejemplo n.º 1
0
 // Adds prefixed reactions to the embed.
 public async Task AddReactions(DiscordMessage embed)
 {
     foreach (DiscordEmoji discordEmoji in GameEmoji.OneThroughNine())
     {
         await embed.CreateReactionAsync(discordEmoji);
     }
 }
Ejemplo n.º 2
0
        // Captures the users selected emoji returns it.
        private async Task <InteractivityResult <MessageReactionAddEventArgs> > InteractivityResult(ulong id, DiscordMessage embed)
        {
            var interactivity = ctx.Client.GetInteractivity();

            return(await interactivity.WaitForReactionAsync(
                       x => x.Message == embed &&
                       x.User.Id == id && GameEmoji.OneThroughNine().Contains(x.Emoji)).ConfigureAwait(false));
        }
Ejemplo n.º 3
0
        // Converts the bots move to an emoji and returns it.
        private DiscordEmoji ConvertAiMove()
        {
            int aiMove = aiLogic.MakeMove(grid.GameGrid, ai.Difficulty, Turn);

            if (aiMove == -1)
            {
                ctx.Channel.SendMessageAsync("The bot couldn't figure out a move.");
                GameActive = false;
            }

            return(GameEmoji.OneThroughNine()[aiMove]);
        }
Ejemplo n.º 4
0
        // Updates the grid with Emoji and value.
        public async Task UpdateField(List <Field> grid, DiscordMessage embed, DiscordEmoji demoji, DiscordEmoji playerEmoji, int playerValue)
        {
            for (int i = 0; i < 9; i++)
            {
                if (demoji == GameEmoji.OneThroughNine()[i])
                {
                    grid[i].FieldEmoji = playerEmoji;
                    grid[i].FieldValue = playerValue;
                }
            }

            await embed.ModifyAsync(embed : new Optional <DiscordEmbed>(CreatePlayField(grid))).ConfigureAwait(false);
        }