Example #1
0
 def check_timer(self):
     if self.entry_open:
         if not on_cooldown(self.open_time, two_mins, test=self.test):
             self.entry_open = False
             return "Registration for the Chocobo Racing Lucky Cup is now closed.  The race is starting."
     else:
         if self.racers:
             if on_cooldown(self.open_time, three_mins, test=self.test):
                 return True
             else:
                 return self.run_race()
Example #2
0
 def command_bonus(self, data):
     if on_cooldown(self.cooldowns['!bonus'], three_mins): return True
     for better in self.betters:
         add_points(self, better, 5)
     self.cooldowns['!bonus'] = set_cooldown()
     return 'Yay Bonus! All betters get 5 %s! (%s)' % (
         self.fmt_currency_name(5), ', '.join(self.betters))
Example #3
0
 def command_not8th(self, data):
     if on_cooldown(self.cooldowns['!not8th'], three_mins): return True
     for better in self.betters:
         add_points(self, better, 1)
     self.cooldowns['!not8th'] = set_cooldown()
     return 'Yay not 8th!  All betters get 1 %s! (%s)' % (
         self.fmt_currency_name(1), ', '.join(self.betters))
Example #4
0
    def check_timer(self):
        if on_cooldown(self.lastRun, self.delay):
            return

        self.getCurrentUsers()
        self.incrementCurrency()
        self.lastRun = set_cooldown()
Example #5
0
 def command_wipe(self, data):
     if not self.raid: return True
     gil = 1
     if not on_cooldown(self.cooldowns['!wipe'], one_min):
         gil = 5
         self.cooldowns['!wipe'] = set_cooldown()
     if add_points(self, self.user, gil):
         return 'Thanks %s! Have %s %s!' % (self.user, gil,
                                            self.fmt_currency_name(gil))
     else:
         return 'Thanks %s!' % self.user
Example #6
0
    def main(self):
        if on_cooldown(self.cooldown, thirty_mins):
            return

        video_dict = None

        # loop until we get a long enough video
        for count in range(0, 10):
            video_id, timestamp, video_dict = self.getYTVideoWithTimestamp(
                video_dict, count)
            if timestamp != 0: break

        self.makeWebPage(video_id, timestamp)
        self.cooldown = set_cooldown()
Example #7
0
 def command_race(self, instance, data):
     if not self.instance: self.instance = instance
     if self.entry_open == False:
         if on_cooldown(instance.cooldowns['!race'], two_mins, test=self.test):
             return "%s is trying to register for the Chocobo Racing Lucky Cup, but they forgot to train their chocobo.  Try again in %s seconds." % (self.instance.user, get_cooldown(instance.cooldowns['!race'], two_mins))
         if not self.race_pending:
             if self.register_racer(data):
                 self.entry_open = True
                 self.race_pending = True
                 self.open_time = set_cooldown()
                 return "%s has registered for the Chocobo Racing Lucky Cup. Everyone can join!  To join type: !race <amount>" % self.instance.user
     else:
         self.register_racer(data)
     return True
Example #8
0
    def updateStreamData(self):
        if on_cooldown(self.lastUpdate, self.updateInterval): return

        stream_data = convert_json(get_webpage(self.url, h=H_BASIC))        
        if stream_data['stream'] == None: 
            self.live = False
            self.stream_start = None 
            self.game = None
        else:
            self.live = True 
            self.stream_start = convert_timestamp(stream_data['stream']['created_at'])
            self.game = stream_data['stream']['game']

        print self.live 
        print self.stream_start
        print self.game
        print self.lastUpdate
        self.lastUpdate = set_cooldown()
Example #9
0
 def command_betpay(self, data):
     if on_cooldown(self.cooldowns['!betpay'], one_min):
         return True
     try:
         payout = int(data[1])
     except ValueError:
         return 'Incorrect payout set.  Format must be !betpay <payout #> option1 option2 etc'
     win_opts = data[2:]
     winners = list()
     for opt in win_opts:
         try:
             val = int(opt)
         except ValueError:
             continue
         if val in self.bet_options:
             add_points_multi(self, self.bet_options[val]['users'], payout)
             winners += self.bet_options[val]['users']
     self.con.commit()
     self.cooldowns['!betpay'] = set_cooldown()
     return 'Added %s %s to: %s' % (payout, self.currency_name,
                                    ', '.join(winners))
Example #10
0
 def check_timer(self):
     if not on_cooldown(self.cooldown, fifteen_mins):
         self.cooldown = set_cooldown()
         return choice(announcements)
Example #11
0
 def check_timer(self):
     if not self.voting_open:
         return True
     elif not on_cooldown(self.start_time, two_mins):
         return self.end_vote()