def __init__(self, instance_id, rcon): self.id = instance_id self.rcon = rcon self.map_rotation = None self.current_map = None self.next_map = None self.last_map_change = None self.is_transitioning = False self.players = [] self.ids = [] self.team1 = None self.team2 = None self.update() path = Path(f'rotations/{str(self.id)}.json') if os.path.exists(path) and instances.Instance( self.id).uses_custom_rotation: try: self.import_rotation(fp=path) except: pass
def _get_selected_instance(self, user_id, guild_id=None): if user_id not in self.selected_instance: self.selected_instance[user_id] = -1 try: instances.Instance(self.selected_instance[user_id]) except: try: self.selected_instance[ user_id] = instances.get_available_instances( user_id, guild_id)[0][0].id except: self.selected_instance[user_id] = -1 return self.selected_instance[user_id]
def delete_instance(self, instance_id): if instance_id in self.instances: del self.instances[instance_id] instances.Instance(instance_id).delete()