Ejemplo n.º 1
0
def setup(bot: commands.Bot):
    bot.add_command(ping)
    bot.add_command(repo)
    bot.add_command(_random)
    bot.add_command(google)
    bot.add_command(namu)
    bot.add_command(contribute)
Ejemplo n.º 2
0
def setup(bot: Bot):
    """
    Register the commands with the bot
    :param bot: the underlying bot
    """
    bot.add_command(settings)
    logger.info("loaded settings commands")
Ejemplo n.º 3
0
def setup(bot: Bot) -> None:
    Card.convert = CardConverter.convert
    modules = glob.glob(path.join(path.dirname(__file__), '*.py'))
    files = [
        path.basename(f)[:-3] for f in modules
        if path.isfile(f) and not f.endswith('__init__.py')
    ]

    commands, names = [], []
    for mod in files:
        n = 0
        m = importlib.import_module(f'.{mod}', package=__name__)
        for _, obj in inspect.getmembers(m):
            if isinstance(obj, Command):
                names.append(obj.name)
                names += obj.aliases
                commands.append(obj)
                n += 1
        if n == 0:
            print(f'No command found in {m.__name__}')

    aliases = text.unambiguous_prefixes(names)
    for cmd in commands:
        to_add = []
        for prefix in aliases:
            if cmd.name.startswith(prefix):
                to_add.append(prefix)
            for alias in cmd.aliases:
                if alias.startswith(prefix):
                    to_add.append(prefix)
        cmd.aliases += to_add
        bot.add_command(cmd)
Ejemplo n.º 4
0
def unload(bot: Bot) -> None:
    """
    Reinstates the original help command.

    This is run if the cog raises an exception on load, or if the extension is unloaded.
    """
    bot.remove_command('help')
    bot.add_command(bot._old_help)
Ejemplo n.º 5
0
def setup(bot: commands.Bot):
    logger.info(f"Loading...")
    if not isdir("backup"):
        logger.info(f"Create backup folder")
        mkdir("backup")
    try:
        bot.add_command(backup_cmd)
    except Exception as e:
        logger.error(f"Error loading: {e}")
    else:
        logger.info(f"Load successful")
Ejemplo n.º 6
0
def register_commands(bot: commands.Bot, s: Server):
    global _server
    global _bot
    _bot = bot
    _server = s
    for i in _commands:
        bot.add_command(i)

    for i in _events:
        bot.event(i)

    for i in _cogs:
        bot.add_cog(i)
Ejemplo n.º 7
0
    def setup(self, bot: commands.Bot):
        """
        Attach a fragment to a bot
        """
        _L.debug("Fragment.setup: bot=%s; %d commands, %d events", bot,
                 len(self.commands), len(self.events))

        self.bot = bot

        for com in self.commands:
            bot.add_command(com)

        for func, name in self.events:
            if name == "task":
                bot.loop.create_task(func())
            else:
                bot.add_listener(func, name)
Ejemplo n.º 8
0
    client.add_cog(Place())
if '2048' not in cmdargs.disable:
    logger.info('Loading 2048', extra={'ctx': dmx})
    from kenny2automate.pow211 import Pow211
    client.add_cog(Pow211(client, db))
if '007' not in cmdargs.disable:
    logger.info('Loading 007', extra={'ctx': dmx})
    from kenny2automate.dbl07 import Dbl07
    client.add_cog(Dbl07(client, db))

logger.info('Loading Eval', extra={'ctx': dmx})
from kenny2automate.eval_ import Eval
client.add_cog(Eval())
logger.info('Loading Games', extra={'ctx': dmx})
from kenny2automate.games import players
client.add_command(players)


@client.event
async def on_ready(*_, **__):
    logger.info('Ready!',
                extra={'ctx': DummyCtx(author=DummyCtx(name='(startup)'))})


@client.command(description='repeat-desc')
async def repeat(ctx, *, arg):
    msg = await ctx.send(arg)
    deleters[ctx.message.id] = msg.id


@client.command(description='hello-desc')
Ejemplo n.º 9
0
def setup(bot: Bot):
    bot.add_command(_8ball)
    bot.add_command(_roll)
Ejemplo n.º 10
0
def setup(bot: Bot):
    bot.add_command(_ping)
    bot.add_command(_debug)
    bot.add_command(_reload)
    bot.add_command(_set_playing)
Ejemplo n.º 11
0
 def __init__(self, bot: commands.Bot):
     # register default layout memes
     for name in ('angry', 'drake', 'happy', 'sleep', 'teeward'):
         command = commands.Command(name=name, func=Memes.default)
         command.cog = self
         bot.add_command(command)
Ejemplo n.º 12
0
def setup(bot: commands.Bot):
    bot.add_command(availability)
Ejemplo n.º 13
0
from conf import TOKEN, PREFIX
from commands import donations, received, guild, website
from discord.ext.commands import Bot


# create bot and set prefix for commands
bot = Bot(command_prefix=PREFIX)


@bot.event
async def on_ready():
    print('Logged in as')
    print(bot.user.name)
    print(bot.user.id)
    print('------')

# register commands
bot.add_command(donations)
bot.add_command(received)
bot.add_command(guild)
bot.add_command(website)


bot.run(TOKEN, bot=True, reconnect=True)
def add_commands_to_bot(bot: Bot):
    bot.add_command(civ6)
Ejemplo n.º 15
0
    def _add_command(self, bot: commands.Bot, command: commands.Command):
        if self.secret:
            command.hidden = True

        bot.add_command(command)
        self.commands.append(command)
Ejemplo n.º 16
0
def setup(bot: Bot):
    bot.add_command(Favorites())
    bot.add_command(History())
Ejemplo n.º 17
0
def setup(bot: Bot):
    bot.add_command(DanbooruCommand())
    bot.add_command(GelbooruCommand())
    bot.add_command(HypnohubCommand())
    bot.add_command(KonachanComCommand())
    bot.add_command(Rule34Command())
    bot.add_command(Rule34PahealCommand())
    bot.add_command(TbibCommand())
    bot.add_command(XbooruCommand())
Ejemplo n.º 18
0
def setup(client: commands.Bot):
    client.add_command(unload)
Ejemplo n.º 19
0
def setup(bot: commands.Bot):
    bot.add_command(prefix)
Ejemplo n.º 20
0
def setup(bot: Bot):
    bot.add_command(management)
    logger.info("loaded management commands")
Ejemplo n.º 21
0
def setup(bot: Bot):
    bot.add_command(_cat)
Ejemplo n.º 22
0
def setup(bot: commands.Bot):
    if _APP_ID:
        bot.add_command(weather)
    else:
        logging.warning("Skip to add weather command")
Ejemplo n.º 23
0
def setup(bot: Bot):
    bot.add_command(Github())
    bot.add_command(Latency())
    bot.add_cog(Listeners(bot))
Ejemplo n.º 24
0
def setup(bot: Bot):
    bot.add_command(_shrug)
    bot.add_command(_meow)
    bot.add_command(_no)
    bot.add_command(_high5)
    bot.add_command(_choose)
    bot.add_command(_catnip)
    bot.add_command(_nyan)
Ejemplo n.º 25
0
def setup(bot: Bot):
    bot.add_command(_xkcd)
Ejemplo n.º 26
0
def setup(bot: Bot):
    print("> Loading WoolAlert")
    bot.add_command(wool_cmd)
Ejemplo n.º 27
0
def setup(bot: Bot):
    bot.add_command(_wikipedia)
    bot.add_command(_load_wiki)
Ejemplo n.º 28
0
def setup(bot: Bot):
    bot.add_command(_spotify)
Ejemplo n.º 29
0
def setup(bot: commands.Bot):
    bot.add_command(help_command)
Ejemplo n.º 30
0
def setup(bot: Bot):
    bot.add_command(_fact)