Пример #1
0
        private void On(WriteEvent e)
        {
            if (e.Type == WriteType.ReceivedPrivateMessage)
            {
                var username = e.GetUser();
                var message  = e.Text.TrimEnd(' '); // Bug ingame, space after each private message

                new PrivateMessageEvent(username, message)
                .RaiseIn(this.BotBits);
            }
            else if (e.Type == WriteType.SentPrivateMessage)
            {
                var username = e.GetUser();
                var message  = $"/pm {username} {e.Text.TrimEnd(' ')}"; // Bug ingame, space after each private message

                var channel = this.GetChatChannel(username);
                if (channel.LastSent == message)
                {
                    channel.LastReceived = message;
                }
            }
            else if (e.Type == WriteType.ChattingTooFast)
            {
                this._warning = true;
            }
        }