🏗 - Moved all owner's commands to a new Cog cmd_other

This commit is contained in:
Florian SYLVAIN
2021-03-14 01:39:21 +01:00
parent f9655b9f90
commit 95b9c4cca6
2 changed files with 44 additions and 31 deletions
+1 -31
View File
@@ -11,7 +11,7 @@ import discord
print('Loading started')
bot = commands.Bot(command_prefix='$')
startup_extensions = ["cmd_other", "cmd_lol", "cmd_osu", "cmd_twitch"]
startup_extensions = ["cmd_other", "cmd_lol", "cmd_osu", "cmd_twitch", "cmd_owner"]
startup_date = datetime.now()
time_s = time()
@@ -43,36 +43,6 @@ async def on_command_error(ctx, error):
await ctx.send(error)
@bot.command(hidden=True, ignore_extra=False)
@commands.is_owner()
async def loadext(ctx, extension):
bot.load_extension(extension)
await ctx.send("Extension loaded.")
@bot.command(hidden=True, ignore_extra=False)
@commands.is_owner()
async def unloadext(ctx, extension):
bot.unload_extension(extension)
await ctx.send("Extension unloaded.")
@bot.command(hidden=True)
@commands.is_owner()
async def update(ctx):
result = str(os.popen('git pull').read())
await ctx.send('``' + result + '``')
if 'Already up to date' not in result:
os.execl(sys.executable, os.path.abspath(__file__), *sys.argv)
@bot.command(hidden=True)
@commands.is_owner()
async def getlogs(ctx):
await ctx.send('Logs since ' + startup_date.strftime("``[%d-%m-%y | %H:%M:%S]``"),
file=discord.File('logs.txt'))
if __name__ == "__main__":
for extension in startup_extensions:
bot.load_extension('ext.' + extension)