Skip to content

Commit

Permalink
Create a new discord file object everytime the command is fired
Browse files Browse the repository at this point in the history
  • Loading branch information
tesence committed Aug 4, 2024
1 parent ff53d78 commit eb93720
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion gumo/api/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,5 +125,5 @@ async def get_seed(self, seed_name: str = None, logic_mode: str = None, key_mode
'spoiler_url': f"{SEEDGEN_API_URL}{seed_data['players'][0]['spoiler_url']}",
'map_url': f"{SEEDGEN_API_URL}{seed_data['map_url']}",
'history_url': f"{SEEDGEN_API_URL}{seed_data['history_url']}",
'seed_files': [discord.File(seed_buffer, filename='randomizer.dat')]
'seed_buffers': [seed_buffer]
}
4 changes: 2 additions & 2 deletions gumo/modules/league.py
Original file line number Diff line number Diff line change
Expand Up @@ -350,8 +350,8 @@ async def league_seed(self, interaction: discord.Interaction):
interaction (discord.Interaction): discord interaction object
"""
await interaction.response.defer(ephemeral=True)
return await interaction.followup.send(content=f"`{self._seed_data['seed_header']}`",
files=self._seed_data['seed_files'])
seed_files = [discord.File(sd, filename='randomizer.dat') for sd in self._seed_data['seed_buffers']]
return await interaction.followup.send(content=f"`{self._seed_data['seed_header']}`", files=seed_files)

async def _league_seed(self):
"""
Expand Down
3 changes: 2 additions & 1 deletion gumo/modules/seed.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,11 +153,12 @@ async def _get_seed_message(self, seed_name: str = None, logic_mode: str = None,
seed_data = await self.api_client.get_seed(seed_name=seed_name, logic_mode=logic_mode, key_mode=key_mode,
goal_mode=goal_mode, spawn=spawn, variations=variations,
item_pool=item_pool, relic_count=relic_count)
seed_files = [discord.File(sd, filename='randomizer.dat') for sd in seed_data['seed_buffers']]
message = f"`{seed_data['seed_header']}`\n" \
f"**Spoiler**: [link]({seed_data['spoiler_url']})\n" \
f"**Map**: [link]({seed_data['map_url']})\n" \
f"**History**: [link]({seed_data['history_url']})"
return message, seed_data['seed_files']
return message, seed_files

@seed.error
@daily.error
Expand Down

0 comments on commit eb93720

Please sign in to comment.