Пример #1
0
        private async void GetResourcesCommand()
        {
            _logService.Write(this, "Loading project with ID " + _project.ProjectID, "debug");
            var tmplist = await _dbService.GetReactions(_project.ProjectID);

            _logService.Write(this, "Loaded " + _project.ProjectID, "debug");
            foreach (var item in tmplist)
            {
                Reactions.Add(item);
            }
            OutputMessages.Add(new OutputMessage {
                Message = Reactions.Count + " reactions loaded for this project", Level = "debug"
            });
            _logService.Write(this, Reactions.Count + " reactions loaded for this project", "debug");
        }
Пример #2
0
        public async ValueTask CreateReactionAsync(DiscordEmoji emoji)
        {
            var user = await Client.GetSelfAsync();

            if (Reactions.Any(r => r.Emoji.Id == emoji.Id && r.UserId == user.Id))
            {
                return;
            }

            Reactions.Add(new TestReaction
            {
                Emoji  = emoji,
                UserId = user.Id
            });
        }
Пример #3
0
        private void UpdateReactions()
        {
            foreach (var reaction in Message.Reactions)
            {
                if (!Reactions.Contains(reaction))
                {
                    _context.Post((o) => Reactions.Add(reaction), null);
                }
            }

            foreach (var reaction in Reactions.ToList())
            {
                if (!Message.Reactions.Contains(reaction))
                {
                    _context.Post((o) => Reactions.Remove(reaction), null);
                }
            }
        }
        internal void ReactionUpdate(double value)
        {
            switch (value)
            {
            //Happy
            case 1:
                var reaction = Reactions.Where(reaction1 => reaction1.ReactionType == ReactionType.Happy).FirstOrDefault();

                if (reaction == null)
                {
                    Reactions.Add(new PostReaction(this, ReactionType.Happy, 1));
                }
                else
                {
                    (reaction as PostReaction).PostReactionCount++;
                }
                ReactionText = "Happy";

                break;

            //Neutral
            case 2:
                reaction = Reactions.Where(reaction1 => reaction1.ReactionType == ReactionType.Neutral).FirstOrDefault();

                if (reaction == null)
                {
                    Reactions.Add(new PostReaction(this, ReactionType.Neutral, 1));
                }
                else
                {
                    (reaction as PostReaction).PostReactionCount++;
                }
                ReactionText = "Neutral";

                break;

            //Wonder
            case 3:
                reaction = Reactions.Where(reaction1 => reaction1.ReactionType == ReactionType.Wonder).FirstOrDefault();

                if (reaction == null)
                {
                    Reactions.Add(new PostReaction(this, ReactionType.Wonder, 1));
                }
                else
                {
                    (reaction as PostReaction).PostReactionCount++;
                }
                ReactionText = "Wonder";

                break;

            //Sad
            case 4:
                reaction = Reactions.Where(reaction1 => reaction1.ReactionType == ReactionType.Sad).FirstOrDefault();

                if (reaction == null)
                {
                    Reactions.Add(new PostReaction(this, ReactionType.Sad, 1));
                }
                else
                {
                    (reaction as PostReaction).PostReactionCount++;
                }
                ReactionText = "Sad";

                break;

            //Angry
            case 5:
                reaction = Reactions.Where(reaction1 => reaction1.ReactionType == ReactionType.Angry).FirstOrDefault();

                if (reaction == null)
                {
                    Reactions.Add(new PostReaction(this, ReactionType.Angry, 1));
                }
                else
                {
                    (reaction as PostReaction).PostReactionCount++;
                }
                ReactionText = "Angry";

                break;

            default:
                break;
            }

            ReactionIndex = 0;
        }
 public void Reaction(GameState state, GameAction reaction)
 {
     this.States.Add(FlattenState.Create(state, reaction, state.YourBot.Other()));
     Reactions.Add(reaction);
 }
Пример #6
0
 public void AddReaction(Reaction reaction)
 {
     Reactions.Add(reaction);
     ReactionAmount++;
 }