예제 #1
0
        public void Fire(BaseRtmResponse response)
        {
            AllMessages?.Invoke(this, new RtmMessageEventArgs <BaseRtmResponse>(response));

            switch (response)
            {
            case HelloResponse helloResponse:
                HelloMessage?.Invoke(this, new RtmMessageEventArgs <HelloResponse>(helloResponse));
                break;

            case PongResponse pongResponse:
                PongMessage?.Invoke(this, new RtmMessageEventArgs <PongResponse>(pongResponse));
                break;

            case UserTypingResponse userTypingResponse:
                UserTypingMessage?.Invoke(this, new RtmMessageEventArgs <UserTypingResponse>(userTypingResponse));
                break;

            case BaseMessageResponse messageResponse:
                switch (messageResponse)
                {
                case BotMessageResponse botMessageResponse:
                    BotMessage?.Invoke(this, new RtmMessageEventArgs <BotMessageResponse>(botMessageResponse));
                    break;

                default:
                    UserMessage?.Invoke(this, new RtmMessageEventArgs <UserMessageResponse>(messageResponse));
                    break;
                }
                break;

            default:
                throw new NotImplementedException();
            }
        }