Пример #1
0
        public void voteYes(string sender)
        {
            if (!addingQuote)
            {
                return;
            }

            if (!quoteAdders.Contains(sender))
            {
                quoteAdders.Add(sender);
                if (quoteAdders.Count == Properties.Settings.Default.quoteVotersNumber)
                {
                    wowiebot.Properties.Settings.Default.quotes.Add(quoteToAdd);
                    wowiebot.Properties.Settings.Default.Save();
                    quoteAdders.Clear();
                    quotes.Add(quoteToAdd);
                    addingQuote = false;
                    quoteTimer.Stop();
                    ChatHandler.sendMessage("Quote added.");
                }
            }

            else if (quoteAdders[0] == sender)
            {
                ChatHandler.sendMessage("Yeah, you added the quote. I got it.");
            }

            else
            {
                ChatHandler.sendMessage("You already voted, dingus.");
            }
        }
Пример #2
0
 public override void handleMessage()
 {
     if (tags["msg-id"] == "sub" || tags["msg-id"] == "resub")
     {
         string reply = Properties.Settings.Default.subResponse;
         reply = reply.Replace("$SENDER", tags["display-name"]);
         reply = reply.Replace("$BROADCASTER", ChatHandler.getChannel());
         reply = reply.Replace("$MONTHS", tags["msg-param-cumulative-months"]);
         ChatHandler.sendMessage(reply);
     }
     else if (tags["msg-id"] == "subgift" || tags["msg-id"] == "anonsubgift")
     {
         string reply = Properties.Settings.Default.giftSubResponse;
         reply = reply.Replace("$SENDER", tags["display-name"]);
         reply = reply.Replace("$BROADCASTER", ChatHandler.getChannel());
         reply = reply.Replace("$MONTHS", tags["msg-param-months"]);
         reply = reply.Replace("$RECIPIENT", tags["msg-param-recipient-display-name"]);
         ChatHandler.sendMessage(reply);
     }
     else if (tags["msg-id"] == "raid")
     {
         string reply = Properties.Settings.Default.raidResponse;
         reply = reply.Replace("$SENDER", tags["msg-param-displayName"]);
         reply = reply.Replace("$BROADCASTER", ChatHandler.getChannel());
         reply = reply.Replace("$COUNT", tags["msg-param-viewerCount"]);
         ChatHandler.sendMessage(reply);
     }
 }
Пример #3
0
        private void QuoteTimer_Elapsed(object sender, ElapsedEventArgs e)
        {
            string reply = Properties.Settings.Default.nonEmbeddableSrResponse;

            reply = reply.Replace("$SENDER", quoteAdders[0]);
            reply = reply.Replace("$BROADCASTER", ChatHandler.getChannel());
            ChatHandler.sendMessage(reply);
            quoteAdders.Clear();
            addingQuote = false;
            quoteTimer.Stop();
        }
Пример #4
0
        public void addQuote(string quote, string sender, bool senderIsMod)
        {
            if (quote.Trim() == "")
            {
                return;
            }
            if (Properties.Settings.Default.quotes == null)
            {
                Properties.Settings.Default.quotes = new System.Collections.Specialized.StringCollection();
                Properties.Settings.Default.Save();
            }
            if (quotes == null)
            {
                string[] arrQuotes = new string[Properties.Settings.Default.quotes.Count];
                Properties.Settings.Default.quotes.CopyTo(arrQuotes, 0);
                quotes              = new List <string>(arrQuotes);
                quoteTimer.Elapsed += QuoteTimer_Elapsed;
            }
            if (addingQuote)
            {
                ChatHandler.sendMessage("Finish adding the current quote first.");
                return;
            }

            quoteToAdd = quote;

            if (Properties.Settings.Default.quoteVotersNumber == 0)
            {
                Properties.Settings.Default.quotes.Add(quoteToAdd);
                Properties.Settings.Default.Save();
                quotes.Add(quoteToAdd);
                ChatHandler.sendMessage("Quote added.");
                return;
            }

            else
            {
                addingQuote = true;
                quoteTimer.Start();
                ChatHandler.sendMessage((Properties.Settings.Default.quoteVotersNumber - 1).ToString() +
                                        " other " + (Properties.Settings.Default.quoteVotersNumber > 2 ? "people need" : "person needs") + " to agree by typing " +
                                        Properties.Settings.Default.prefix +
                                        ChatHandler.getVoteYesCommand() +
                                        " to add the quote! Ends in one minute.");
                quoteAdders.Add(sender);
            }
        }
Пример #5
0
        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);
            }
        }