예제 #1
0
        public override Option <string> Handle(string[] messageElements, Message originalMessage)
        {
            var result = AttendanceRegistry.FindCurrent(originalMessage.ConversationId);

            return(result.Match(
                       e => {
                e.In(originalMessage.From.Id, originalMessage.From.Name);
                return $"{originalMessage.From.Name} in";
            },
                       () => "No active event at the moment"
                       ));
        }
예제 #2
0
        public override Option <string> Handle(string[] messageElements, Message originalMessage)
        {
            var result =
                messageElements.Length > 1 ?
                AttendanceRegistry.FindByName(originalMessage.ConversationId, string.Join(" ", messageElements.Skip(1))) :
                AttendanceRegistry.FindCurrent(originalMessage.ConversationId);

            return(result.Match(
                       e => e.ToString(),
                       () => "No event found"
                       ));
        }
예제 #3
0
        public override Option <string> Handle(string[] messageElements, Message originalMessage)
        {
            var result = AttendanceRegistry.FindCurrent(originalMessage.ConversationId);

            return(result.Match(
                       e =>
            {
                e.Out(originalMessage.From.Id, originalMessage.From.Name,
                      messageElements.Length > 1 ? string.Join(" ", messageElements.Skip(1)) : string.Empty);
                return $"{originalMessage.From.Name} out";
            },
                       () => "No active event at the moment"
                       ));
        }