Skip to content

Commit

Permalink
command optimisation
Browse files Browse the repository at this point in the history
  • Loading branch information
bugsbirb committed May 1, 2024
1 parent a36da72 commit 1f511a2
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 6 deletions.
3 changes: 3 additions & 0 deletions Cogs/Events/on_error.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ async def on_command_error(self, ctx: commands.Context, error: commands.CommandE
return
if isinstance(error, commands.NotOwner):
return
if isinstance(error, commands.BadLiteralArgument):
await ctx.send(f"{no} **{ctx.author.display_name}**, you have used an invalid argument.")
return
if isinstance(error, commands.MemberNotFound):
await ctx.send(f"{no} **{ctx.author.display_name}**, that member isn't in the server.")
return
Expand Down
6 changes: 3 additions & 3 deletions Cogs/Modules/applicationresults.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ async def modulecheck(ctx: commands.Context):

@commands.hybrid_command(description="Apply for a position.")
@app_commands.autocomplete(application=applications)
async def apply(self, ctx: commands.Context, application: str):
async def apply(self, ctx: commands.Context, *,application: str):
if not await self.has_required_role(ctx, application):
return

Expand Down Expand Up @@ -111,7 +111,7 @@ async def application(self, ctx: commands.Context):

@application.command(description="Blacklist a user from applying from an application.")
@app_commands.autocomplete(application=applications)
async def blacklist(self, ctx: commands.Context, user: discord.Member, application: str):
async def blacklist(self, ctx: commands.Context, user: discord.Member, *,application: str):
if not await self.modulecheck(ctx):
await ctx.send(f"{no} **{ctx.author.display_name}**, the applications module isn't enabled.", allowed_mentions=discord.AllowedMentions.none())
return
Expand All @@ -135,7 +135,7 @@ async def blacklist(self, ctx: commands.Context, user: discord.Member, applicati

@application.command(description="Unblacklist a user from applying from an application.")
@app_commands.autocomplete(application=applications)
async def unblacklist(self, ctx: commands.Context, user: discord.Member, application: str):
async def unblacklist(self, ctx: commands.Context, user: discord.Member, *,application: str):
if not await self.modulecheck(ctx):
await ctx.send(f"{no} **{ctx.author.display_name}**, the applications module isn't enabled.", allowed_mentions=discord.AllowedMentions.none())
return
Expand Down
2 changes: 1 addition & 1 deletion Cogs/Modules/partnerships.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ async def log(self, ctx: commands.Context, respresentive: discord.User, server:

@partnership.command(description="Terminate a server partnership")
@app_commands.autocomplete(server=servers_autocomplete)
async def terminate(self, ctx: commands.Context, server, reason: discord.ext.commands.Range[str, 1, 2000]):
async def terminate(self, ctx: commands.Context, server, *,reason: discord.ext.commands.Range[str, 1, 2000]):
if not await self.modulecheck(ctx):
await ctx.send(f"{no} **{ctx.author.display_name}**, the partnership module isn't enabled.", allowed_mentions=discord.AllowedMentions.none())
return
Expand Down
2 changes: 1 addition & 1 deletion Cogs/Modules/stafffeedback.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ async def remove(self, ctx: commands.Context, id: int):

@feedback.command(description="Rate a staff member", name="give")
@app_commands.describe(staff="The staff member you want to rate.", rating="The rating you want to give (1-10).", feedback="The feedback you want to give.")
async def feedback2(self, ctx: commands.Context, staff: discord.Member, rating: Literal['1/10', '2/10', '3/10', '4/10', '5/10', '6/10', '7/10', '8/10', '9/10', '10/10'], feedback: discord.ext.commands.Range[str, 1, 2000]):
async def feedback2(self, ctx: commands.Context, staff: discord.Member, rating: Literal['1/10', '2/10', '3/10', '4/10', '5/10', '6/10', '7/10', '8/10', '9/10', '10/10'], *,feedback: discord.ext.commands.Range[str, 1, 2000]):
await ctx.defer(ephemeral=True)
existing_feedback = await stafffeedback.find_one({'guild_id': ctx.guild.id, 'staff': staff.id, 'author': ctx.author.id})
optionresult = await options.find_one({'guild_id': ctx.guild.id})
Expand Down
2 changes: 1 addition & 1 deletion Cogs/Modules/suspension.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ async def modulecheck(ctx: commands.Context):

@commands.hybrid_command(description="Suspend a staff member")
@app_commands.describe(staff="What user are you suspending?",length="e.g 1w (m/h/d/w)", reason="What is the reason for this suspension?")
async def suspend(self, ctx: commands.Context, staff: discord.Member, length: discord.ext.commands.Range[str, 1, 20], reason: discord.ext.commands.Range[str, 1, 2000]):
async def suspend(self, ctx: commands.Context, staff: discord.Member, length: discord.ext.commands.Range[str, 1, 20], *,reason: discord.ext.commands.Range[str, 1, 2000]):
await ctx.defer(ephemeral=True)
if not await self.modulecheck(ctx):
await ctx.send(f"{no} **{ctx.author.display_name}**, the suspension module isn't enabled.", allowed_mentions=discord.AllowedMentions.none())
Expand Down

0 comments on commit 1f511a2

Please sign in to comment.