Exemple #1
0
        public virtual void handleMessage()
        {
#if DEBUG
            ChatHandler.writeLineToFormBox(rawMessage);
#endif
        }
        public override void handleMessage()
        {
            if (sender != ChatHandler.getBotNick())
            {
                ChatHandler.messagesBetweenPeriodics++;
            }

            if (sentMessage.StartsWith("\u0001ACTION"))
            {
                sentMessage = sentMessage.Replace("\u0001ACTION", "");
                sentMessage = sentMessage.Replace("\u0001", "");
                ChatHandler.writeLineToFormBox("* " + sender + " " + sentMessage);
            }
            else
            {
                ChatHandler.writeLineToFormBox("<" + (senderIsBroadcaster ? "~" : (senderIsMod ? "@" : "")) + sender + "> " + sentMessage);
            }

            if (sentMessage.StartsWith(Properties.Settings.Default.prefix))
            {
                string command;
                if (sentMessage.Contains(" "))
                {
                    command = sentMessage.Substring(1, sentMessage.IndexOf(" ") - 1);
                }
                else
                {
                    command = sentMessage.Substring(1, sentMessage.Length - 1);
                }

                command = command.ToLower();

                try
                {
                    string msg = ChatHandler.getMessageFromCommand(command);

                    if (senderHasPermission(command))
                    {
                        string args = getCommandArguments(sentMessage);
                        msg = replaceVariables(msg, args);
                        ChatHandler.sendMessage(msg);
                    }

                    else
                    {
                        ChatHandler.sendMessage(Properties.Settings.Default.noPermsMessage);
                    }
                }
                catch (Exception e)
                {
                    if (command == "wowie" && ChatHandler.getBotNick() == "wowiebot")
                    {
                        ChatHandler.sendMessage("wowie");
                    }
                }
            }

            else
            {
                ChatHandler.printLinkTitles(sentMessage);
            }


            if (bits > 0) // >= Properties.Settings.Default.bitsMessageThreshold)
            {
                string msg = Properties.Settings.Default.messageForBits;
                msg = msg.Replace("$COUNT", bits.ToString());
                msg = msg.Replace("$SENDER", sender);
                ChatHandler.sendMessage(msg);
            }
        }