<commit_before>from twisted.internet import reactor
from IRCMessage import IRCMessage
from IRCResponse import IRCResponse, ResponseType
from Function import Function
import GlobalVars

class Instantiate(Function):
    Help = "timer <time> - starts a countdown timer and notifies you when time's up."

    def GetResponse(self, HubbeBot, message):
        if message.Type != "PRIVMSG":
            return
        if message.Command == "timer":
            if len(message.ParameterList) != 1:
                return IRCResponse(ResponseType.Say, "Please use only 1 argument.", message.ReplyTo)
            try:
                delay = float(message.ParameterList[0])
                if delay > (60*60*24*365):
                    return IRCResponse(ResponseType.Say, "Do you really need a timer that long?", message.ReplyTo)
            except:
                return IRCResponse(ResponseType.Say, "That doesn't look like a number to me...", message.ReplyTo)
            reactor.callLater(delay, self.notifyUser, HubbeBot, delay, message)
            return IRCResponse(ResponseType.Say, message.User.Name + ": A timer has been started!", message.ReplyTo)
            
            
    def notifyUser(self, HubbeBot, message):
        HubbeBot.sendResponse(IRCResponse(ResponseType.Say, message.User.Name + ": Your " + message.ParameterList[0] + " second timer is up!" , message.ReplyTo))<commit_msg>And yet again I'm a bit dense<commit_after>from twisted.internet import reactor
from IRCMessage import IRCMessage
from IRCResponse import IRCResponse, ResponseType
from Function import Function
import GlobalVars

class Instantiate(Function):
    Help = "timer <time> - starts a countdown timer and notifies you when time's up."

    def GetResponse(self, HubbeBot, message):
        if message.Type != "PRIVMSG":
            return
        if message.Command == "timer":
            if len(message.ParameterList) != 1:
                return IRCResponse(ResponseType.Say, "Please use only 1 argument.", message.ReplyTo)
            try:
                delay = float(message.ParameterList[0])
                if delay > (60*60*24*365):
                    return IRCResponse(ResponseType.Say, "Do you really need a timer that long?", message.ReplyTo)
            except:
                return IRCResponse(ResponseType.Say, "That doesn't look like a number to me...", message.ReplyTo)
            reactor.callLater(delay, self.notifyUser, HubbeBot, message)
            return IRCResponse(ResponseType.Say, message.User.Name + ": A timer has been started!", message.ReplyTo)
            
            
    def notifyUser(self, HubbeBot, message):
        HubbeBot.sendResponse(IRCResponse(ResponseType.Say, message.User.Name + ": Your " + message.ParameterList[0] + " second timer is up!" , message.ReplyTo))
{'fraction_non_alphanumeric': 0.09483065953654189, 'fraction_numerical': 0.009269162210338681, 'mean_word_length': 2.7018469656992083, 'pattern_counts': {'":': 8, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1023220', 'n_tokens_mistral': 781, 'n_tokens_neox': 749, 'n_words': 228}