| @@ -55,10 +55,11 @@ def main ( | |||||
| snack_time = SnackTime (game) | snack_time = SnackTime (game) | ||||
| CurrentTime (game, DEERJIKA_FONT) | CurrentTime (game, DEERJIKA_FONT) | ||||
| broadcast: Broadcast | None = None | |||||
| try: | try: | ||||
| broadcast = Broadcast (os.environ['BROADCAST_CODE']) | broadcast = Broadcast (os.environ['BROADCAST_CODE']) | ||||
| except Exception: | |||||
| pass | |||||
| except KeyError: | |||||
| broadcast = None | |||||
| waiting_balloon = (False, '', '') | waiting_balloon = (False, '', '') | ||||
| last_flags_poll: float = 0 | last_flags_poll: float = 0 | ||||
| @@ -99,10 +100,15 @@ def main ( | |||||
| answer_flag.answered = True | answer_flag.answered = True | ||||
| answer_flag.save () | answer_flag.save () | ||||
| DB.commit () | DB.commit () | ||||
| add_query (broadcast) | |||||
| except Exception as ex: | except Exception as ex: | ||||
| DB.rollback () | DB.rollback () | ||||
| print (ex) | print (ex) | ||||
| try: | |||||
| if broadcast is not None: | |||||
| add_query (broadcast) | |||||
| except Exception as ex: | |||||
| print (ex) | |||||
| game.redraw () | game.redraw () | ||||
| @@ -582,8 +588,9 @@ class Balloon (GameObject): | |||||
| query = self.query | query = self.query | ||||
| if CommonModule.len_by_full (query) > 21: | if CommonModule.len_by_full (query) > 21: | ||||
| query = CommonModule.mid_by_full (query, 0, 19.5) + '...' | query = CommonModule.mid_by_full (query, 0, 19.5) + '...' | ||||
| answer = Surface ((375, ((CommonModule.len_by_full (self.answer) - 1) // 16 + 1) * 23.4375), | |||||
| pygame.SRCALPHA) | |||||
| answer = Surface ( | |||||
| (375, int (((CommonModule.len_by_full (self.answer) - 1) // 16 + 1) * 23.4375)), | |||||
| pygame.SRCALPHA) | |||||
| for i in range (int (CommonModule.len_by_full (self.answer) - 1) // 16 + 1): | for i in range (int (CommonModule.len_by_full (self.answer) - 1) // 16 + 1): | ||||
| answer.blit (DEERJIKA_FONT.render ( | answer.blit (DEERJIKA_FONT.render ( | ||||
| CommonModule.mid_by_full (self.answer, 16 * i, 16), True, (192, 0, 0)), | CommonModule.mid_by_full (self.answer, 16 * i, 16), True, (192, 0, 0)), | ||||