mirror of
https://github.com/polyjitter/searchbot-discord.git
synced 2024-08-14 22:46:55 +00:00
Added Cog Emojis
This commit is contained in:
parent
98d7d486ed
commit
3b187f8d5a
7 changed files with 29 additions and 6 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -54,3 +54,4 @@ coverage.xml
|
|||
docs/_build/
|
||||
extensions/__pycache__/core.cpython-38.pyc
|
||||
extensions/__pycache__/core.cpython-38.pyc
|
||||
extensions/__pycache__/core.cpython-38.pyc
|
||||
|
|
Binary file not shown.
|
@ -16,9 +16,11 @@ class BotList(commands.Cog, name='Bot List'):
|
|||
"""Provides various utilities for handling BotList stuff."""
|
||||
|
||||
def __init__(self, bot):
|
||||
|
||||
# Main Stuff
|
||||
self.bot = bot
|
||||
self.request = bot.request
|
||||
self.emoji = "\U0001F5F3"
|
||||
|
||||
# List Tokens
|
||||
self.dbl_token = bot.config['DBL']
|
||||
|
|
|
@ -16,20 +16,26 @@ import math
|
|||
import psutil
|
||||
from extensions.helpcmd import TaciHelpCommand
|
||||
|
||||
|
||||
class Core(commands.Cog):
|
||||
"""Provides all core features of a bot."""
|
||||
|
||||
def __init__(self, bot):
|
||||
|
||||
# Main Stuff
|
||||
self.bot = bot
|
||||
self.settings = {
|
||||
self.emoji = "\U0001F4E6"
|
||||
self.settings = {
|
||||
'extensions': []
|
||||
}
|
||||
|
||||
# Help Command
|
||||
self._original_help_command = bot.help_command
|
||||
if bot.config['CUSTOM_HELP']:
|
||||
bot.help_command = TaciHelpCommand()
|
||||
bot.help_command.cog = self
|
||||
|
||||
# Extensions
|
||||
self._init_extensions()
|
||||
|
||||
def _init_extensions(self):
|
||||
|
|
|
@ -25,8 +25,13 @@ class Developer(commands.Cog):
|
|||
"""Provides various resources for developers."""
|
||||
|
||||
def __init__(self, bot):
|
||||
|
||||
# Main Stuff
|
||||
self.bot = bot
|
||||
self.request = bot.request
|
||||
self.emoji = "\U0001F3D7"
|
||||
|
||||
# Repl/Eval Stuff
|
||||
self.repl_sessions = {}
|
||||
self.repl_embeds = {}
|
||||
self._eval = {}
|
||||
|
|
|
@ -11,6 +11,8 @@ import itertools
|
|||
|
||||
class TaciHelpCommand(commands.MinimalHelpCommand):
|
||||
def __init__(self, **options):
|
||||
|
||||
# Main Stuff
|
||||
super().__init__(**options)
|
||||
self.command_attrs['help'] = "Find more assistance on this bot."
|
||||
self.subcommands_heading = "Subcommands"
|
||||
|
@ -94,7 +96,7 @@ class TaciHelpCommand(commands.MinimalHelpCommand):
|
|||
self.paginator.add_line(f"**{heading}**")
|
||||
|
||||
# TODO Make the Core Dynamic
|
||||
if heading == 'Core':
|
||||
if heading == '\U0001F4E6 Core':
|
||||
# `command1`, `command2`, `command3`
|
||||
# On Same Line
|
||||
self.paginator.add_line(", ".join(f"`{c.name}`" for c in commands))
|
||||
|
@ -125,7 +127,10 @@ class TaciHelpCommand(commands.MinimalHelpCommand):
|
|||
no_category = '\u200b{0.no_category}'.format(self)
|
||||
def get_category(command, *, no_category=no_category):
|
||||
cog = command.cog
|
||||
return cog.qualified_name if cog is not None else no_category
|
||||
if cog is not None:
|
||||
return f"{cog.emoji} {cog.qualified_name}" if cog.emoji else cog.qualified_name
|
||||
else:
|
||||
return no_category
|
||||
|
||||
# Gets all commands and categories to iterate over
|
||||
filtered = await self.filter_commands(bot.commands, sort=True, key=get_category)
|
||||
|
@ -134,13 +139,13 @@ class TaciHelpCommand(commands.MinimalHelpCommand):
|
|||
# Splits Bot List and Core commands out of the others
|
||||
for category, commands in to_iterate:
|
||||
commands = sorted(commands, key=lambda c: c.name) if self.sort_commands else list(commands)
|
||||
if category in ['Core', 'Bot List']:
|
||||
if category in ['\U0001F4E6 Core', '\U0001F5F3 Bot List']:
|
||||
main_cmds.extend(commands)
|
||||
else:
|
||||
other_cmds[category] = commands
|
||||
|
||||
# Core/Bot List commands become compacted
|
||||
self.add_bot_commands_formatting(main_cmds, 'Core')
|
||||
self.add_bot_commands_formatting(main_cmds, '\U0001F4E6 Core')
|
||||
|
||||
# Everything else is normal
|
||||
for category, commands in other_cmds.items():
|
||||
|
@ -164,7 +169,8 @@ class TaciHelpCommand(commands.MinimalHelpCommand):
|
|||
# New Line
|
||||
|
||||
# **Cog Name**
|
||||
self.paginator.add_line(f"**{cog.qualified_name}**")
|
||||
self.paginator.add_line(
|
||||
f"{cog.emoji} **{cog.qualified_name}**" if cog.emoji else f"{cog.qualified_name}")
|
||||
|
||||
# _Description if there_
|
||||
if cog.description:
|
||||
|
|
|
@ -16,9 +16,12 @@ class Search(commands.Cog):
|
|||
"""Searches the web for a variety of different resources."""
|
||||
|
||||
def __init__(self, bot):
|
||||
|
||||
# Main Stuff
|
||||
self.bot = bot
|
||||
self.request = bot.request
|
||||
self.instances = bot.instances
|
||||
self.emoji = "\U0001F50D"
|
||||
|
||||
async def _search_logic(self, query: str, is_nsfw: bool = False, category: str = None):
|
||||
"""Provides search logic for all search commands."""
|
||||
|
|
Loading…
Reference in a new issue