public async Task <bool> ProcessDialogue()
        {
            while (currentStep != null)
            {
                currentStep.OnMessageAdded += (message) => messages.Add(message);

                bool cancelled = await currentStep.ProcessStep(client, channel, user);

                if (cancelled)
                {
                    await DeleteMessages();

                    var cancelEmbed = new DiscordEmbedBuilder
                    {
                        Title       = "The Dialogue Has Successfully being cancelled",
                        Description = user.Mention,
                        Color       = DiscordColor.Green
                    };
                    await channel.SendMessageAsync(embed : cancelEmbed);
                }
                currentStep = currentStep.NextStep;
            }

            await DeleteMessages();

            return(true);
        }
        public async Task <bool> ProcessDialogue()
        {
            while (_currentStep != null)
            {
                _currentStep.OnMessageAdded += (message) => messages.Add(message);

                bool cancelled = await _currentStep.ProcessStep(_client, _channel, _user).ConfigureAwait(false);

                if (cancelled)
                {
                    await DeleteMessages().ConfigureAwait(false);

                    var cancelEmbed = new DiscordEmbedBuilder
                    {
                        Title       = "The Dialogue Has Successfully Been Cancelled",
                        Description = _user.Mention,
                        Color       = DiscordColor.Green
                    };

                    await _channel.SendMessageAsync(embed : cancelEmbed).ConfigureAwait(false);

                    return(false);
                }

                _currentStep = _currentStep.NextStep;
            }

            await DeleteMessages().ConfigureAwait(false);

            return(true);
        }
Esempio n. 3
0
 public DialogueHandler(DiscordClient client, DiscordChannel channel, DiscordUser user, IDialogueStep startingStep)
 {
     _channel     = channel;
     _client      = client;
     _user        = user;
     _currentStep = startingStep;
 }
 public DialogueHandler(DiscordClient client, DiscordChannel channel, DiscordUser user, IDialogueStep startingStep)
 {
     this.client  = client;
     this.channel = channel;
     this.user    = user;
     currentStep  = startingStep;
 }
Esempio n. 5
0
 public IntStep(
     string content,
     IDialogueStep nextStep,
     int?minValue = null,
     int?maxValue = null) : base(content)
 {
     _nextStep = nextStep;
     _minValue = minValue;
     _maxValue = maxValue;
 }
Esempio n. 6
0
 public TextStep(
     string content,
     IDialogueStep nextStep,
     int?minLength = null,
     int?maxlength = null) : base(content)
 {
     _nextStep  = nextStep;
     _minLength = minLength;
     _maxLength = maxlength;
 }
Esempio n. 7
0
 public TextStep(
     string content,
     IDialogueStep nextStep,
     int?minLength = null,
     int?maxLength = null) : base(content)
 {
     this.nextStep  = nextStep;
     this.minLength = minLength;
     this.maxLength = maxLength;
 }
Esempio n. 8
0
 public DoubleStep(
     string content,
     IDialogueStep nextStep,
     double?minValue = null,
     double?maxValue = null) : base(content)
 {
     _nextStep = nextStep;
     _minValue = minValue;
     _maxValue = maxValue;
 }
Esempio n. 9
0
 public UlongStep(
     string content,
     IDialogueStep nextStep,
     ulong?minValue = null,
     ulong?maxValue = null) : base(content)
 {
     _nextStep = nextStep;
     _minValue = minValue;
     _maxValue = maxValue;
 }
Esempio n. 10
0
 public IntDialogStep(
     string content,
     IDialogueStep nextStep,
     int?minValue = null,
     int?maxValue = null) : base(
         content)
 {
     this.nextStep = nextStep;
     this.minValue = minValue;
     this.maxValue = maxValue;
 }
Esempio n. 11
0
        public async Task <bool> ProcessDialogue()
        {
            while (_currentStep != null)
            {
                _currentStep.OnMessageAdded += (message) => messages.Add(message);

                var ResultEnum = await _currentStep.ProcessStep(_client, _channel, _user);

                if (ResultEnum == eDialogueType.Cancel)
                {
                    await DeleteMessages().ConfigureAwait(false);

                    var cancelEmbed = new DiscordEmbedBuilder
                    {
                        Title       = "The Dialogue Has Succesfully Been Cancelled",
                        Description = _user.Mention,
                        Color       = DiscordColor.DarkRed,
                    };

                    await _channel.SendMessageAsync(embed : cancelEmbed).ConfigureAwait(false);

                    return(false);
                }

                else if (ResultEnum == eDialogueType.Continue)
                {
                    _currentStep = _currentStep.NextStep;
                }

                else if (ResultEnum == eDialogueType.Timeout)
                {
                    _currentStep = _currentStep.NextStep;
                    await DeleteMessages().ConfigureAwait(false);

                    var cancelEmbed = new DiscordEmbedBuilder
                    {
                        Title       = "The Dialogue Has Succesfully Been Cancelled",
                        Description = _user.Mention,
                        Color       = DiscordColor.DarkRed,
                    };
                    await _channel.SendMessageAsync(embed : cancelEmbed).ConfigureAwait(false);

                    return(false);
                }
            }
            return(true);
        }
        public async Task <bool> ProcessDialoge()
        {
            while (_currentStep != null)
            {
                try
                {
                    _currentStep.OnMessageAdded += (message) => messages.Add(message);

                    bool cancelled = await _currentStep.ProcessStep(_client, _channel, _user).ConfigureAwait(false);

                    if (cancelled)
                    {
                        await DeleteMessages().ConfigureAwait(false);

                        /*
                         * var cancelEmbed = new DiscordEmbedBuilder
                         * {
                         *  Description = "Session ended"
                         * };
                         *
                         * await _channel.SendMessageAsync(embed: cancelEmbed).ConfigureAwait(false);
                         */

                        return(false);
                    }

                    _currentStep = _currentStep.NextStep;
                } catch
                {
                    await DeleteMessages().ConfigureAwait(false);

                    return(true);
                }
            }

            await DeleteMessages().ConfigureAwait(false);

            return(true);
        }
Esempio n. 13
0
 public void SetNextStep(IDialogueStep nextStep)
 {
     _nextStep = nextStep;
 }
Esempio n. 14
0
 public PollStep(string content, IDialogueStep nextStep, DiscordMessage pollMessage, DiscordEmbedBuilder pollEmbed) : base(content)
 {
     _nextStep    = nextStep;
     _pollMessage = pollMessage;
     _pollEmbed   = pollEmbed;
 }
Esempio n. 15
0
 public BoolStep(string content, IDialogueStep nextStep) : base(content)
 {
     _nextStep = nextStep;
 }