Skip to content

Commit a4e616c

Browse files
authored
Fixed
1 parent 9b47c9d commit a4e616c

File tree

1 file changed

+13
-17
lines changed

1 file changed

+13
-17
lines changed

cogs/owner.py

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def __init__(self, bot):
2525
description="Load a cog",
2626
)
2727
@checks.is_owner()
28-
async def load(self, ctx, cog: str):
28+
async def load(self, context: Context, cog: str):
2929
"""
3030
The bot will load the given cog.
3131
@@ -35,19 +35,18 @@ async def load(self, ctx, cog: str):
3535
try:
3636
await self.bot.load_extension(f"cogs.{cog}")
3737
except Exception as e:
38-
embed=discord.Embed(title="load", description=f"Could not load the `{cog}` cog.")
39-
await ctx.send(embed=embed)
40-
return
38+
embed=discord.Embed(title="Error!", description=f"Could not load the `{cog}` cog.")
39+
await context.send(embed=embed) return
4140
embed=discord.Embed(title="Load", description=f"Successfully loaded the `{cog}` cog.")
42-
await ctx.send(embed=embed)
41+
await context.send(embed=embed)
4342

4443

4544
@commands.hybrid_command(
4645
name="unload",
4746
description="Unloads a cog.",
4847
)
4948
@checks.is_owner()
50-
async def unload(self, ctx, cog: str):
49+
async def unload(self, context: Context, cog: str):
5150
"""
5251
The bot will unload the given cog.
5352
@@ -57,33 +56,30 @@ async def unload(self, ctx, cog: str):
5756
try:
5857
await self.bot.unload_extension(f"cogs.{cog}")
5958
except Exception as e:
60-
embed=discord.Embed(title="Unload", description=f"Could not unload the `{cog}` cog.")
61-
await ctx.send(embed=embed)
62-
return
59+
embed=discord.Embed(title="Error!", description=f"Could not unload the `{cog}` cog.")
60+
await context.send(embed=embed) return
6361
embed=discord.Embed(title="Unload", description=f"Successfully loaded the `{cog}` cog.")
64-
await ctx.send(embed=embed)
62+
await context.send(embed=embed)
6563

6664
@commands.hybrid_command(
6765
name="reload",
6866
description="Reloads a cog.",
6967
)
7068
@checks.is_owner()
71-
async def reload(self, ctx, cog: str):
69+
async def reload(self, context: Context, cog: str):
7270
"""
7371
The bot will reload the given cog.
7472
7573
:param context: The hybrid command context.
7674
:param cog: The cog to be reloaded.
7775
"""
7876
try:
79-
await self.bot.unload_extension(f"cogs.{cog}")
80-
await self.bot.load_extension(f"cogs.{cog}")
77+
await self.bot.reload_extension(f"cogs.{cog}")
8178
except Exception as e:
82-
embed=discord.Embed(title="Reload", description=f"Could not reload the `{cog}` cog.")
83-
await ctx.send(embed=embed)
84-
return
79+
embed=discord.Embed(title="Error!", description=f"Could not reload the `{cog}` cog.")
80+
await context.send(embed=embed) return
8581
embed=discord.Embed(title="Reload", description=f"Successfully reloaded the `{cog}` cog.")
86-
await ctx.send(embed=embed)
82+
await context.send(embed=embed)
8783

8884
@commands.hybrid_command(
8985
name="shutdown",

0 commit comments

Comments
 (0)