Skip to content

Commit

Permalink
🌟 style: fix code style issues with Black
Browse files Browse the repository at this point in the history
  • Loading branch information
GuniBot committed Dec 12, 2023
1 parent 031910a commit 9fb7ada
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions plugins/groups/groups.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ def channel(self) -> discord.TextChannel:
if self.channel_id is None:
return None
if self._channel is None:
self._channel = self.bot.get_guild(self.guild_id).get_channel(self.channel_id)
self._channel = self.bot.get_guild(self.guild_id).get_channel(
self.channel_id
)
return self._channel

def member_is_in(self, member: discord.Member) -> bool:
Expand All @@ -60,8 +62,10 @@ def to_str(self) -> str:
"""Transform the group to a human-readable string"""
channel = f"<#{self.channel_id}>" if self.channel_id else "None"
private = "True" if self.privacy == 1 else "False"
return f"Group: <@&{self.role_id}> (*id : {self.role_id}*)\n"\
return (
f"Group: <@&{self.role_id}> (*id : {self.role_id}*)\n"
f"┗━▷ Owner: <@{self.owner_id}> - Channel: {channel} - Private: {private}"
)


class GroupConverter(commands.Converter):
Expand All @@ -76,7 +80,7 @@ async def convert(self, ctx: MyContext, arg: str) -> Group:
except commands.BadArgument as exc:
await ctx.send(
await ctx.bot._(ctx.channel, "groups.error.unknown-group", g=arg),
ephemeral=True
ephemeral=True,
)
raise exc
# make sure the cog is actually loaded, let's not break everything
Expand All @@ -86,12 +90,14 @@ async def convert(self, ctx: MyContext, arg: str) -> Group:
return res
await ctx.send(
await ctx.bot._(ctx.channel, "groups.error.unknown-group", g=arg),
ephemeral=True
ephemeral=True,
)
raise commands.BadArgument()


GroupType = Annotated[Group, GroupConverter]


class Groups(commands.Cog):
def __init__(self, bot: Gunibot):
self.bot = bot
Expand Down Expand Up @@ -507,9 +513,7 @@ async def group_join(self, ctx: MyContext, group: GroupType):
else:
await ctx.author.add_roles(group.role(), reason="Joined a group")
await ctx.send(
await self.bot._(
ctx.guild.id, "groups.join", name=group.role().name
)
await self.bot._(ctx.guild.id, "groups.join", name=group.role().name)
)

@group_main.command(name="leave")
Expand All @@ -526,9 +530,7 @@ async def group_leave(self, ctx: MyContext, group: GroupType):
return
await ctx.author.remove_roles(group.role(), reason="Left a group")
await ctx.send(
await self.bot._(
ctx.guild.id, "groups.leave", name=group.role().name
)
await self.bot._(ctx.guild.id, "groups.leave", name=group.role().name)
)

@group_main.group(name="admin", aliases=["manage"])
Expand Down

0 comments on commit 9fb7ada

Please sign in to comment.