mirror of
https://github.com/Floriansylvain/Risitas_BOT.git
synced 2026-08-19 19:53:19 +02:00
🏗 - Moved all owner's commands to a new Cog cmd_other
This commit is contained in:
@@ -0,0 +1,43 @@
|
|||||||
|
from discord.ext import commands
|
||||||
|
from datetime import datetime
|
||||||
|
from __main__ import startup_date
|
||||||
|
import discord
|
||||||
|
import asyncio
|
||||||
|
|
||||||
|
|
||||||
|
class OwnerCmds(commands.Cog, name='Owner commands'):
|
||||||
|
def __init__(self, bot):
|
||||||
|
self.bot = bot
|
||||||
|
|
||||||
|
@commands.command(hidden=True, ignore_extra=False)
|
||||||
|
@commands.is_owner()
|
||||||
|
async def loadext(self, ctx, extension):
|
||||||
|
bot.load_extension(extension)
|
||||||
|
await ctx.send("Extension loaded.")
|
||||||
|
|
||||||
|
|
||||||
|
@commands.command(hidden=True, ignore_extra=False)
|
||||||
|
@commands.is_owner()
|
||||||
|
async def unloadext(self, ctx, extension):
|
||||||
|
bot.unload_extension(extension)
|
||||||
|
await ctx.send("Extension unloaded.")
|
||||||
|
|
||||||
|
|
||||||
|
@commands.command(hidden=True)
|
||||||
|
@commands.is_owner()
|
||||||
|
async def update(self, 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)
|
||||||
|
|
||||||
|
|
||||||
|
@commands.command(hidden=True)
|
||||||
|
@commands.is_owner()
|
||||||
|
async def getlogs(self, ctx):
|
||||||
|
await ctx.send('Logs since ' + startup_date.strftime("``[%d-%m-%y | %H:%M:%S]``"),
|
||||||
|
file=discord.File('logs.txt'))
|
||||||
|
|
||||||
|
|
||||||
|
def setup(bot):
|
||||||
|
bot.add_cog(OwnerCmds(bot))
|
||||||
+1
-31
@@ -11,7 +11,7 @@ import discord
|
|||||||
print('Loading started')
|
print('Loading started')
|
||||||
|
|
||||||
bot = commands.Bot(command_prefix='$')
|
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()
|
startup_date = datetime.now()
|
||||||
time_s = time()
|
time_s = time()
|
||||||
@@ -43,36 +43,6 @@ async def on_command_error(ctx, error):
|
|||||||
await ctx.send(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__":
|
if __name__ == "__main__":
|
||||||
for extension in startup_extensions:
|
for extension in startup_extensions:
|
||||||
bot.load_extension('ext.' + extension)
|
bot.load_extension('ext.' + extension)
|
||||||
|
|||||||
Reference in New Issue
Block a user