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); }
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; }
public IntStep( string content, IDialogueStep nextStep, int?minValue = null, int?maxValue = null) : base(content) { _nextStep = nextStep; _minValue = minValue; _maxValue = maxValue; }
public TextStep( string content, IDialogueStep nextStep, int?minLength = null, int?maxlength = null) : base(content) { _nextStep = nextStep; _minLength = minLength; _maxLength = maxlength; }
public TextStep( string content, IDialogueStep nextStep, int?minLength = null, int?maxLength = null) : base(content) { this.nextStep = nextStep; this.minLength = minLength; this.maxLength = maxLength; }
public DoubleStep( string content, IDialogueStep nextStep, double?minValue = null, double?maxValue = null) : base(content) { _nextStep = nextStep; _minValue = minValue; _maxValue = maxValue; }
public UlongStep( string content, IDialogueStep nextStep, ulong?minValue = null, ulong?maxValue = null) : base(content) { _nextStep = nextStep; _minValue = minValue; _maxValue = maxValue; }
public IntDialogStep( string content, IDialogueStep nextStep, int?minValue = null, int?maxValue = null) : base( content) { this.nextStep = nextStep; this.minValue = minValue; this.maxValue = maxValue; }
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); }
public void SetNextStep(IDialogueStep nextStep) { _nextStep = nextStep; }
public PollStep(string content, IDialogueStep nextStep, DiscordMessage pollMessage, DiscordEmbedBuilder pollEmbed) : base(content) { _nextStep = nextStep; _pollMessage = pollMessage; _pollEmbed = pollEmbed; }
public BoolStep(string content, IDialogueStep nextStep) : base(content) { _nextStep = nextStep; }