Skip to content

Commit

Permalink
Style Reformatting
Browse files Browse the repository at this point in the history
  • Loading branch information
japandotorg authored Sep 24, 2023
1 parent ca3f3d7 commit dd87ce3
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions battleroyale/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,16 @@ async def cog_load(self) -> None:
async def generate_image(
self, user_1: discord.Member, user_2: discord.Member, to_file: bool = True
) -> Union[discord.File, Image.Image]:
backgrounds = [self.backgrounds_path / background for background in os.listdir(self.backgrounds_path)]
backgrounds = [
self.backgrounds_path / background for background in os.listdir(self.backgrounds_path)
]
if self.custom_backgrounds_path.exists():
backgrounds.extend([self.custom_backgrounds_path / background for background in os.listdir(self.custom_backgrounds_path)])
backgrounds.extend(
[
self.custom_backgrounds_path / background
for background in os.listdir(self.custom_backgrounds_path)
]
)
while True:
background = random.choice(backgrounds)
with open(background, mode="rb") as f:
Expand Down Expand Up @@ -284,12 +291,11 @@ async def _list_backgrounds(self, ctx: commands.Context):
"""
path = self.custom_backgrounds_path
if not path.exists() or not (custom_backgrounds := os.listdir(path)):
raise commands.UserFeedbackCheckFailure(
"You don't have any custom background images."
)
raise commands.UserFeedbackCheckFailure("You don't have any custom background images.")
await SimpleMenu(
pages=[
box(page, lang="py") for page in pagify(
box(page, lang="py")
for page in pagify(
"\n".join(f"- {custom_background}" for custom_background in custom_backgrounds)
)
]
Expand Down Expand Up @@ -419,7 +425,9 @@ async def auto(
- `skip`: will skip to results.
"""
guild_members = list(ctx.guild.members)
users: List[discord.Member] = random.sample(guild_members, min(players - 1, len(guild_members)))
users: List[discord.Member] = random.sample(
guild_members, min(players - 1, len(guild_members))
)
players: List[discord.Member] = list(filter(lambda u: not u.bot, users))
if ctx.author not in players:
players.append(ctx.author)
Expand Down

0 comments on commit dd87ce3

Please sign in to comment.