def get_ghost_replay(self, login):
replay_name = 'dedimania_{}.Replay.Gbx'.format(uuid.uuid4().hex)
try:
await self.instance.gbx('SaveBestGhostsReplay', login, replay_name)
except:
return None
try:
async with self.instance.storage.open('UserData/Replays/{}'.format(replay_name)) as ghost_file:
return await ghost_file.read()
except FileNotFoundError as e:
message = '$f00Error: Dedimania requires you to have file access on the server. We can\'t fetch' \
'the driven replay!'
logger.error('Please make sure we can access the dedicated files. Configure your storage driver correctly! '
'{}'.format(str(e)))
await self.instance.chat(message)
raise DedimaniaException('Can\'t access replay file')
except PermissionError as e:
message = '$f00Error: Dedimania requires you to have file access on the server. We can\'t fetch' \
'the driven replay because of an permission problem!'
logger.error('We can\'t read files in the dedicated folder, your permissions don\'t allow us to read it! '
'{}'.format(str(e)))
await self.instance.chat(message)
raise DedimaniaException('Can\'t access files due to permission problems')
评论列表
文章目录