Skip to content
This repository has been archived by the owner on Nov 22, 2021. It is now read-only.

Commit

Permalink
Merge pull request #61 from parafoxia/v1.2
Browse files Browse the repository at this point in the history
Merge extra 1.2 changes before release
  • Loading branch information
parafoxia authored Sep 23, 2020
2 parents e6b2559 + f1cedd0 commit 2b1223f
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 10 deletions.
3 changes: 2 additions & 1 deletion solaris/bot/cogs/help.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,8 @@ def full_syntax(ctx, cmd, prefix):
if (p := cmd.parent) is None:
return f"```{prefix}{invokations} {cmd.signature}```"
else:
return f"```{prefix}|parent| {invokations} {cmd.signature}```"
p_invokations = "|".join([p.name, *p.aliases])
return f"```{prefix}{p_invokations} {invokations} {cmd.signature}```"

@staticmethod
async def required_permissions(ctx, cmd):
Expand Down
29 changes: 20 additions & 9 deletions solaris/bot/cogs/warn.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ async def on_ready(self):
if not self.bot.ready.booted:
self.bot.ready.up(self)

@commands.group(name="warn", invoke_without_command=True)
@commands.group(name="warn", invoke_without_command=True, help="Warns one or more members in your server.")
@checks.module_has_initialised(MODULE_NAME)
@checks.author_can_warn()
async def warn_group(
Expand Down Expand Up @@ -119,7 +119,7 @@ async def warn_group(
f"{target.mention}, you have been warned for {warn_type} for the {string.ordinal(wc)} of {max_strikes or 3} times. You now have {points} of your allowed {max_points or 12} points."
)

@warn_group.command(name="remove", aliases=["rm"])
@warn_group.command(name="remove", aliases=["rm"], help="Removes a warning.")
@checks.module_has_initialised(MODULE_NAME)
@checks.author_can_warn()
async def warn_remove_command(self, ctx, warn_id: str):
Expand All @@ -130,7 +130,7 @@ async def warn_remove_command(self, ctx, warn_id: str):

await ctx.send(f"{self.bot.tick} Warn {warn_id} removed.")

@warn_group.command(name="reset")
@warn_group.command(name="reset", help="Resets a member's warnings.")
@checks.module_has_initialised(MODULE_NAME)
@commands.has_permissions(administrator=True)
async def warn_reset_command(self, ctx, target: discord.Member):
Expand All @@ -143,7 +143,7 @@ async def warn_reset_command(self, ctx, target: discord.Member):

await ctx.send(f"{self.bot.tick} Warnings for {target.display_name} reset.")

@warn_group.command(name="list")
@warn_group.command(name="list", help="Lists a member's warnings.")
@checks.module_has_initialised(MODULE_NAME)
@checks.author_can_warn()
async def warn_list_command(self, ctx, target: t.Optional[t.Union[discord.Member, str]]):
Expand Down Expand Up @@ -186,7 +186,11 @@ async def warn_list_command(self, ctx, target: t.Optional[t.Union[discord.Member
)
)

@commands.group(name="warntype", invoke_without_command=True)
@commands.group(
name="warntype",
invoke_without_command=True,
help="Manages warn types. Use the command for information on available subcommands.",
)
@checks.module_has_initialised(MODULE_NAME)
@checks.author_can_configure()
async def warntype_group(self, ctx):
Expand All @@ -211,7 +215,7 @@ async def warntype_group(self, ctx):
)
)

@warntype_group.command(name="new")
@warntype_group.command(name="new", help="Creates a new warn type.")
@checks.module_has_initialised(MODULE_NAME)
@checks.author_can_configure()
async def warntype_new_command(self, ctx, warn_type: str, points: int):
Expand Down Expand Up @@ -244,7 +248,10 @@ async def warntype_new_command(self, ctx, warn_type: str, points: int):
)
await ctx.send(f'{self.bot.tick} The warn type "{warn_type}" has been created, and is worth {points} points.')

@warntype_group.command(name="edit")
@warntype_group.command(
name="edit",
help="Edits an existing warn type. Existing warn records are updated to reflect the changes, but action is not retroactively taken based on point values.",
)
@checks.module_has_initialised(MODULE_NAME)
@checks.author_can_configure()
async def warntype_edit_command(self, ctx, warn_type: str, new_name: str, points: int):
Expand Down Expand Up @@ -280,7 +287,11 @@ async def warntype_edit_command(self, ctx, warn_type: str, new_name: str, points
f'{self.bot.tick} The warn type "{new_name}" (formerly "{warn_type}") is now worth {points} points.'
)

@warntype_group.command(name="delete", aliases=["del"])
@warntype_group.command(
name="delete",
aliases=["del"],
help="Deletes a warn type. Existing warn records are updated to reflect the changes, but action is not retroactively taken based on point values.",
)
@checks.module_has_initialised(MODULE_NAME)
@checks.author_can_configure()
async def warntype_delete_command(self, ctx, warn_type: str):
Expand All @@ -297,7 +308,7 @@ async def warntype_delete_command(self, ctx, warn_type: str):
await self.bot.db.execute("DELETE FROM warns WHERE GuildID = ? AND WarnType = ?", ctx.guild.id, warn_type)
await ctx.send(f'{self.bot.tick} Warn type "{warn_type}" deleted.')

@warntype_group.group(name="list")
@warntype_group.group(name="list", help="Lists the server's warn types.")
@checks.module_has_initialised(MODULE_NAME)
@checks.author_can_configure()
async def warntype_list_command(self, ctx):
Expand Down

0 comments on commit 2b1223f

Please sign in to comment.