예제 #1
0
        public TwitchMessage(string rawMessage, string author, string content, TwitchMessageType type)
        {
            RawMessage = rawMessage;

            Type    = type;
            Author  = author;
            Content = content;
        }
        /// <summary>
        /// Send a message to the OnReceiveMessage-event.
        /// </summary>
        /// <param name="errorMessage">The message to send.</param>
        /// <param name="type">The message-type.</param>
        protected void SendClientMessage(string errorMessage, TwitchMessageType type)
        {
            TwitchMessage ownMessage = TwitchMessage.Default;
            ownMessage.Message = string.IsNullOrWhiteSpace(errorMessage) ? "" : errorMessage;
            ownMessage.Sender = Name.ToLower();
            ownMessage.Type = type;
            ownMessage.Channel = _nicName;

            Fire_OnMessageReceived(ownMessage);
        }
        /// <summary>
        /// Creates a TwitchMessage-object.
        /// </summary>
        /// <param name="message">Received message.</param>
        /// <param name="sender">Sender of this message.</param>
        /// <param name="channel">Channel where the message was send.</param>
        /// <param name="commandCode">The code of the command. If there is no code, default should be 0.</param>
        /// <param name="command">The service-command.</param>
        /// <param name="type">Message-type to handle the message-state.</param>
        public TwitchMessage(string message, string sender, string channel, uint commandCode,
            string command, TwitchMessageType type)
        {
            Sender = string.IsNullOrWhiteSpace(sender) ? "" : sender;
            Channel = string.IsNullOrWhiteSpace(channel) ? "" : channel;
            Message = string.IsNullOrWhiteSpace(message) ? "" : message;
            Command = string.IsNullOrWhiteSpace(command) ? "NONE" : command;

            CommandCode = commandCode;
            Type = type;
        }