black refactoring
This commit is contained in:
parent
0475b18437
commit
ea88addc42
@ -227,8 +227,7 @@ class CCRole(commands.Cog):
|
|||||||
if not role_list:
|
if not role_list:
|
||||||
return "None"
|
return "None"
|
||||||
return ", ".join(
|
return ", ".join(
|
||||||
discord.utils.get(ctx.guild.roles, id=roleid).name
|
discord.utils.get(ctx.guild.roles, id=roleid).name for roleid in role_list
|
||||||
for roleid in role_list
|
|
||||||
)
|
)
|
||||||
|
|
||||||
embed.add_field(name="Text", value="```{}```".format(cmd["text"]), inline=False)
|
embed.add_field(name="Text", value="```{}```".format(cmd["text"]), inline=False)
|
||||||
@ -325,9 +324,7 @@ class CCRole(commands.Cog):
|
|||||||
|
|
||||||
async def eval_cc(self, cmd, message: discord.Message, ctx: commands.Context):
|
async def eval_cc(self, cmd, message: discord.Message, ctx: commands.Context):
|
||||||
"""Does all the work"""
|
"""Does all the work"""
|
||||||
if cmd["proles"] and not {role.id for role in message.author.roles} & set(
|
if cmd["proles"] and not {role.id for role in message.author.roles} & set(cmd["proles"]):
|
||||||
cmd["proles"]
|
|
||||||
):
|
|
||||||
log.debug(f"{message.author} missing required role to execute {ctx.invoked_with}")
|
log.debug(f"{message.author} missing required role to execute {ctx.invoked_with}")
|
||||||
return # Not authorized, do nothing
|
return # Not authorized, do nothing
|
||||||
|
|
||||||
|
@ -67,10 +67,7 @@ class InfoChannel(Cog):
|
|||||||
|
|
||||||
default_channel_ids = {k: None for k in self.default_channel_names}
|
default_channel_ids = {k: None for k in self.default_channel_names}
|
||||||
# Only members is enabled by default
|
# Only members is enabled by default
|
||||||
default_enabled_counts = {
|
default_enabled_counts = {k: k == "members" for k in self.default_channel_names}
|
||||||
k: k == "members" for k in self.default_channel_names
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
default_guild = {
|
default_guild = {
|
||||||
"category_id": None,
|
"category_id": None,
|
||||||
|
@ -249,7 +249,6 @@ class PlantTycoon(commands.Cog):
|
|||||||
if gardener.products[product] > 0
|
if gardener.products[product] > 0
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
degradation = (
|
degradation = (
|
||||||
100
|
100
|
||||||
/ (gardener.current["time"] / 60)
|
/ (gardener.current["time"] / 60)
|
||||||
@ -306,9 +305,7 @@ class PlantTycoon(commands.Cog):
|
|||||||
damage_msg = "You used {} too many times!".format(product)
|
damage_msg = "You used {} too many times!".format(product)
|
||||||
else:
|
else:
|
||||||
damage_msg = "You gave too much of {}.".format(product)
|
damage_msg = "You gave too much of {}.".format(product)
|
||||||
message = "{} Your plant lost some health. :wilted_rose:".format(
|
message = "{} Your plant lost some health. :wilted_rose:".format(damage_msg)
|
||||||
damage_msg
|
|
||||||
)
|
|
||||||
gardener.points += self.defaults["points"]["add_health"]
|
gardener.points += self.defaults["points"]["add_health"]
|
||||||
await gardener.save_gardener()
|
await gardener.save_gardener()
|
||||||
elif product in gardener.products or product_category != "tool":
|
elif product in gardener.products or product_category != "tool":
|
||||||
@ -440,9 +437,7 @@ class PlantTycoon(commands.Cog):
|
|||||||
if not gardener.badges:
|
if not gardener.badges:
|
||||||
em.add_field(name="**Badges**", value="None")
|
em.add_field(name="**Badges**", value="None")
|
||||||
else:
|
else:
|
||||||
badges = "".join(
|
badges = "".join("{}\n".format(badge.capitalize()) for badge in gardener.badges)
|
||||||
"{}\n".format(badge.capitalize()) for badge in gardener.badges
|
|
||||||
)
|
|
||||||
|
|
||||||
em.add_field(name="**Badges**", value=badges)
|
em.add_field(name="**Badges**", value=badges)
|
||||||
if gardener.products:
|
if gardener.products:
|
||||||
|
@ -97,12 +97,7 @@ class ReactRestrict(Cog):
|
|||||||
"""
|
"""
|
||||||
current_combos = await self.combo_list()
|
current_combos = await self.combo_list()
|
||||||
|
|
||||||
to_keep = [
|
to_keep = [c for c in current_combos if c.message_id != message_id or c.role_id != role.id]
|
||||||
c
|
|
||||||
for c in current_combos
|
|
||||||
if c.message_id != message_id or c.role_id != role.id
|
|
||||||
]
|
|
||||||
|
|
||||||
|
|
||||||
if to_keep != current_combos:
|
if to_keep != current_combos:
|
||||||
await self.set_combo_list(to_keep)
|
await self.set_combo_list(to_keep)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user