Пример #1
0
    async def on_message(self, message):
        if (message.author == self.user or message.author.bot
                or isinstance(message.channel, discord.abc.PrivateChannel)
                or not self.is_ready()):
            return

        owner = message.author
        if owner.id == config["owner"] and not permissions.has_permission(
                owner, Permission.BANANA_OWNER):
            permissions.give_permission(owner, Permission.BANANA_OWNER)

        # what are you doing daughter - dev
        # fixing mac's shitty slow regex parser - me, theel
        message.content = message.content.replace(
            f"<@!{self.user.id}>", dueserverconfig.server_cmd_key(
                message.guild), 1) if message.content.startswith(
                    f"<@!{self.user.id}>") else message.content
        message.content = message.content.replace(
            f"<@{self.user.id}>", dueserverconfig.server_cmd_key(
                message.guild), 1) if message.content.startswith(
                    f"<@{self.user.id}>") else message.content

        await events.on_message_event(message)
Пример #2
0
            while len(shard_clients) <= loaded_clients:
                pass
        while not loaded():
            pass
        loader.load_modules(packages=loader.COMMANDS)
        util.logger.info("Ready after %ds", time.time() - start_time)
        ### Tasks
        loop = asyncio.get_event_loop()
        from dueutil import tasks
        for task in tasks.tasks:
            asyncio.ensure_future(task(), loop=loop)
        loop.run_forever()


def loaded():
    return len(shard_clients) == shard_count and all(
        client.loaded for client in shard_clients)


if __name__ == "__main__":
    util.logger.info("Starting DueUtil!")
    config = gconf.other_configs
    bot_key = config["botToken"]
    shard_count = config["shardCount"]
    shard_names = config["shardNames"]
    owner = discord.Member(user={"id": config["owner"]})
    if not permissions.has_permission(owner, Permission.DUEUTIL_ADMIN):
        permissions.give_permission(owner, Permission.DUEUTIL_ADMIN)
    util.load(shard_clients)
    run_due()
Пример #3
0
            while len(shard_clients) <= loaded_clients:
                pass
        while not loaded():
            pass
        loader.load_modules(packages=loader.COMMANDS)
        util.logger.info("Ready after %ds", time.time() - start_time)
        ### Tasks
        loop = asyncio.get_event_loop()
        from dueutil import tasks
        for task in tasks.tasks:
            asyncio.ensure_future(task(), loop=loop)
        loop.run_forever()


def loaded():
    return len(shard_clients) == shard_count and all(
        client.loaded for client in shard_clients)


if __name__ == "__main__":
    util.logger.info("Starting DueUtil!")
    config = gconf.other_configs
    bot_key = config["botToken"]
    shard_count = config["shardCount"]
    shard_names = config["shardNames"]
    owner = discord.Member(user={"id": config["owner"]})
    if not permissions.has_permission(owner, Permission.DUEUTIL_OWNER):
        permissions.give_permission(owner, Permission.DUEUTIL_OWNER)
    util.load(shard_clients)
    run_due()