<commit_before>
from brutal.core.plugin import BotPlugin, cmd, event, match, threaded

class Countdown(BotPlugin):
    minutes = 0
    text = ""
    
    @cmd
    def countdown(self, event):
        """Creates a timer and returns a reminder after it expires."""
        if len(event.args) < 2:
            return "Not a valid countdown request, try again!"
        
        self.minutes = int(event.args[0]) 
        self.text = ' '.join(event.args[1:])
    
        self.delay_task(60, self.dec, event=event)
        
        return "Starting coundtown for {0}".format(self.text)
    
    def dec(self, event):
        self.minutes -= 1
        self.msg("T-{0} ( {1} )".format(self.minutes, self.text), event=event) 
        if self.minutes != 0:
            self.delay_task(60, self.dec, event=event)<commit_msg>Countdown: Added option to set countdown delay.<commit_after>
from brutal.core.plugin import BotPlugin, cmd

class Countdown(BotPlugin):
    minutes = 0
    countdown_delay = 0 #in seconds
    text = ""
    
    @cmd
    def countdown(self, event):
        """Creates timer and returns reminder after it expires."""
        if len(event.args) < 2:
            return "Not a valid countdown request, try again!"

        second_arg = event.args[1]        
        
        self.minutes = int(event.args[0]) 
        if(second_arg.isdigit()):
            self.countdown_delay = int(second_arg)
            self.text = ' '.join(event.args[2:])
        else:
            self.countdown_delay = 60
            self.text = ' '.join(event.args[1:])
    
        self.delay_task(self.countdown_delay, self.dec, event=event)
        
        return "Starting coundtown for {0}".format(self.text)

    
    def dec(self, event):
        self.minutes -= 1
        if self.minutes != 0:
            self.msg("T-{0} ( {1} )".format(self.minutes, self.text), event=event)
            self.delay_task(self.countdown_delay, self.dec, event=event)
        else:
            self.msg("It's happening! {0}".format(self.text), event=event)    
{'fraction_non_alphanumeric': 0.12911143838978892, 'fraction_numerical': 0.013745704467353952, 'mean_word_length': 2.1499227202472952, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, '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': '5764977', 'n_tokens_mistral': 661, 'n_tokens_neox': 624, 'n_words': 153}