public virtual FilterResult ShouldProcess() { var data = new Dictionary <string, dynamic>(); foreach (Filter f in _filters) { if (f is null) { continue; } var p = f.ShouldProcess(); if (!p && !f.inverse) { _ok = false; _valid = true; return(FilterResult.False); } else if (p.Result && f.inverse) { _ok = false; _valid = true; return(FilterResult.False); } if (!string.IsNullOrEmpty(p.Name)) { data.TryAdd(p.Name, p.Data); } } _ok = true; _valid = true; return(FilterResult.True("main", data)); }
public override FilterResult ShouldProcess() { Bot.Types.User sender = _update.GetSender(); if (sender is null) { return(FilterResult.False); } if (_userids != null) { if (_userids.Any(x => sender.Id == x)) { return(FilterResult.True("sender", sender)); } } else { if (string.IsNullOrEmpty(sender.Username)) { return(FilterResult.False); } if (_usernames.Any(x => sender.Username == x)) { return(FilterResult.True("sender", sender)); } } return(FilterResult.False); }
public override FilterResult ShouldProcess() { return(_text.ToLower() == "ok" ? FilterResult.True() : FilterResult.False); }