mirror of
https://github.com/polyjitter/searchbot-discord.git
synced 2024-08-14 22:46:55 +00:00
Moved help to models, added extend list
This commit is contained in:
parent
bcfdb8c9aa
commit
7e09232e56
4 changed files with 42 additions and 4 deletions
Binary file not shown.
|
@ -14,7 +14,7 @@ import sys
|
|||
import cpuinfo
|
||||
import math
|
||||
import psutil
|
||||
from extensions.helpcmd import TaciHelpCommand
|
||||
from extensions.models.help import TaciHelpCommand
|
||||
|
||||
|
||||
class Core(commands.Cog):
|
||||
|
@ -120,8 +120,8 @@ Number of extensions present: {len(ctx.bot.cogs)}
|
|||
|
||||
# Provides status of extension
|
||||
if name is not None:
|
||||
status = "is" if f'extensions.{name}' in self.extensions_list else "is not"
|
||||
msg = f"**extensions.{name}** {status} currently loaded and/or existent."
|
||||
status = "is" if name in self.extensions_list else "is not"
|
||||
msg = f"**{name}** {status} currently loaded and/or existent."
|
||||
|
||||
# Handles empty calls
|
||||
else:
|
||||
|
@ -184,6 +184,18 @@ Number of extensions present: {len(ctx.bot.cogs)}
|
|||
else:
|
||||
await m.edit(content='Extension isn\'t loaded.')
|
||||
|
||||
@extend.command(name='list')
|
||||
async def list_cmd(self, ctx):
|
||||
"""Lists all extensions loaded by the bot."""
|
||||
|
||||
# Message Construction
|
||||
msg = "**Loaded Extensions**\n\n"
|
||||
msg += '\n'.join(f'`{e}`' for e in self.extensions_list)
|
||||
msg += "\n\n_See the other subcommands of this command to manage them._"
|
||||
|
||||
# Message Sending
|
||||
await ctx.send(msg)
|
||||
|
||||
@commands.command(aliases=['exit', 'reboot'])
|
||||
@commands.is_owner()
|
||||
async def restart(self, ctx):
|
||||
|
|
|
@ -241,4 +241,8 @@ class TaciHelpCommand(commands.MinimalHelpCommand):
|
|||
|
||||
# Sends the completed help output.
|
||||
self.paginator.close_page() # TODO What does this do?
|
||||
await self.send_pages()
|
||||
await self.send_pages()
|
||||
|
||||
def setup(bot):
|
||||
"""Lets helpcmd be added and reloaded as an extension."""
|
||||
pass
|
22
main.py
22
main.py
|
@ -49,6 +49,7 @@ class Bot(commands.Bot):
|
|||
def _init_extensions(self):
|
||||
"""Initializes extensions."""
|
||||
|
||||
# Extensions
|
||||
for ext in os.listdir('extensions'):
|
||||
if ext.endswith('.py'):
|
||||
try:
|
||||
|
@ -57,6 +58,27 @@ class Bot(commands.Bot):
|
|||
f'extensions.{ext[:-3]}')
|
||||
except Exception as e:
|
||||
print(e)
|
||||
|
||||
# Models
|
||||
for ext in os.listdir('extensions/models'):
|
||||
if ext.endswith('.py'):
|
||||
try:
|
||||
bot.load_extension(f'extensions.models.{ext[:-3]}')
|
||||
self.extensions_list.append(
|
||||
f'extensions.models.{ext[:-3]}')
|
||||
except Exception as e:
|
||||
print(e)
|
||||
|
||||
# Utils
|
||||
for ext in os.listdir('extensions/utils'):
|
||||
if ext.endswith('.py'):
|
||||
try:
|
||||
bot.load_extension(f'extensions.utils.{ext[:-3]}')
|
||||
self.extensions_list.append(
|
||||
f'extensions.utils.{ext[:-3]}')
|
||||
except Exception as e:
|
||||
print(e)
|
||||
|
||||
|
||||
async def _get_prefix_new(self, bot, msg):
|
||||
"""More flexible check for prefix."""
|
||||
|
|
Loading…
Reference in a new issue