def count_vote(rcon: RecordedRcon, struct_log): config = VoteMapConfig() if not config.get_vote_enabled(): return v = VoteMap() if vote := v.is_vote(struct_log.get("sub_content")): logger.debug("Vote chat detected: %s", struct_log["message"]) map_name = v.register_vote(struct_log["player"], struct_log["timestamp_ms"] / 1000, vote) try: temporary_broadcast( rcon, config.get_votemap_thank_you_text().format( player_name=struct_log["player"], map_name=map_name), 5, ) except Exception: logger.warning("Unable to output thank you message") v.apply_with_retry(nb_retry=2)
def notify_camera(rcon: RecordedRcon, struct_log): send_to_discord_audit(message=struct_log["message"], by=struct_log["player"]) try: if hooks := get_prepared_discord_hooks("camera"): embeded = DiscordEmbed( title=f'{struct_log["player"]} - {struct_log["steam_id_64_1"]}', description=struct_log["sub_content"], color=242424, ) for h in hooks: h.add_embed(embeded) h.execute() except Exception: logger.exception("Unable to forward to hooks") config = CameraConfig() if config.is_broadcast(): temporary_broadcast(rcon, struct_log["message"], 60) if config.is_welcome(): temporary_welcome(rcon, struct_log["message"], 60)