Exemple #1
0
        private async Task BuildProgressTrackerPostAsync(ChallengeRank cr, string nameOfTrack, IUserMessage messageToEdit = null)
        {
            if (messageToEdit == null)
            {
                var tracker = new SceneChallengeInfo(cr, nameOfTrack);
                messageToEdit = ReplyAsync(embed: tracker.BuildEmbed() as Embed).Result;
            }
            else
            {
                var tracker = new SceneChallengeInfo().FromMessage(messageToEdit, cr);
                await messageToEdit.ModifyAsync(msg =>
                {
                    msg.Content = string.Empty;
                    msg.Embed   = tracker.BuildEmbed() as Embed;
                });
            }

            await messageToEdit.RemoveAllReactionsAsync();

            _ = Task.Run(async() =>
            {
                await messageToEdit.AddReactionAsync(DecreaseEmoji);
                await messageToEdit.AddReactionAsync(IncreaseEmoji);
                await messageToEdit.AddReactionAsync(FullEmoji);
                await messageToEdit.AddReactionAsync(emptyChallengeEmoji);
                await messageToEdit.AddReactionAsync(fullChallengeEmoji);
                await messageToEdit.AddReactionAsync(RollEmoji);
            }).ConfigureAwait(false);

            return;
        }
Exemple #2
0
        private async Task ReactionIncreaseProgressEvent(IUserMessage message, ISocketMessageChannel channel, SocketReaction reaction, IUser user)
        {
            if (!IsSceneChallengeMessage(message))
            {
                return;
            }
            SceneChallengeInfo scene = new SceneChallengeInfo().FromMessage(message);

            scene.Ticks += scene.TicksPerProgress;
            await message.RemoveReactionAsync(reaction.Emote, user).ConfigureAwait(false);

            await message.ModifyAsync(msg => msg.Embed = scene.BuildEmbed() as Embed);
        }