コード例 #1
0
ファイル: roles.py プロジェクト: ozzhates/AceBot
    def __init__(self, bot):
        super().__init__(bot)

        self.editing = set()
        self.messages = dict()

        self.config = ConfigTable(bot, table='role', primary='guild_id')
コード例 #2
0
    def __init__(self, bot):
        super().__init__(bot)

        self.config = ConfigTable(bot,
                                  'mod_config',
                                  'guild_id',
                                  record_class=SecurityConfigRecord)
        self.event_timer = EventTimer(bot, 'event_complete')
コード例 #3
0
    def __init__(self, bot):
        super().__init__(bot)

        self.config = ConfigTable(bot, 'trivia', ('guild_id', 'user_id'))

        self.trivia_categories = None

        self.bot.loop.create_task(self.get_trivia_categories())
コード例 #4
0
ファイル: roles.py プロジェクト: spiiralol/AceBot
    def __init__(self, bot):
        super().__init__(bot)

        self.editing = set()
        self.messages = dict()

        self.footer_tasks = dict()
        self.footer_lock = asyncio.Lock()

        self.config = ConfigTable(bot, table='role', primary='guild_id')
コード例 #5
0
    def __init__(self, bot):
        super().__init__(bot)

        self.config = ConfigTable(bot,
                                  'mod_config',
                                  'guild_id',
                                  record_class=SecurityConfigRecord)
        self.event_timer = EventTimer(bot, 'event_complete')

        asyncio.create_task(self.check_tempbans())
コード例 #6
0
ファイル: ace.py プロジェクト: CloakerSmoker/AceBot
    def __init__(self, db, **kwargs):
        super().__init__(command_prefix=self.prefix_resolver,
                         owner_id=OWNER_ID,
                         description=DESCRIPTION,
                         help_command=EditedMinimalHelpCommand(),
                         max_messages=20000,
                         activity=BOT_ACTIVITY,
                         **kwargs)

        self.db = db
        self.config = ConfigTable(self,
                                  table='config',
                                  primary='guild_id',
                                  record_class=GuildConfigRecord)

        self.ready = asyncio.Event()
        self.startup_time = datetime.utcnow()

        aiohttp_log = logging.getLogger('aiotrace')

        async def on_request_end(session, ctx, end):
            resp = end.response
            aiohttp_log.info('[%s %s] %s %s (%s)', str(resp.status),
                             resp.reason, end.method.upper(), end.url,
                             resp.content_type)

        trace_config = aiohttp.TraceConfig()
        trace_config.on_request_end.append(on_request_end)

        self.aiohttp = aiohttp.ClientSession(
            loop=self.loop,
            timeout=aiohttp.ClientTimeout(total=5),
            trace_configs=[trace_config],
        )

        self.modified_times = dict()

        # help command. this is messy but it has to be because the lib doesn't really like you having
        # two different help commands. maybe I will see if I can clean this up in the future
        self.static_help_command = self.help_command
        command_impl = self.help_command._command_impl
        self.help_command = PaginatedHelpCommand()
        self.static_help_command._command_impl = command_impl

        self.remove_command('help')
        self.add_command(commands.Command(self._help, name='help'))
コード例 #7
0
ファイル: stars.py プロジェクト: spiiralol/AceBot
    def __init__(self, bot):
        super().__init__(bot)

        self.config = ConfigTable(bot,
                                  table='starboard',
                                  primary='guild_id',
                                  record_class=StarboardConfigRecord)

        self.purge_query = '''
			SELECT id, guild_id, channel_id, star_message_id
			FROM star_msg
			WHERE guild_id = $1
			AND starred_at < $2
			AND (SELECT COUNT(id) FROM starrers WHERE starrers.star_id=star_msg.id) < $3
		'''

        self.purger.start()
コード例 #8
0
ファイル: ace.py プロジェクト: Run1e/AceBot
    def __init__(self, **kwargs):
        super().__init__(command_prefix=self.prefix_resolver,
                         owner_id=OWNER_ID,
                         description=DESCRIPTION,
                         help_command=PaginatedHelpCommand(),
                         max_messages=20000,
                         activity=disnake.Game('Booting up...'),
                         status=disnake.Status.do_not_disturb,
                         **kwargs)

        # created in login
        self.db = None

        self.config = ConfigTable(self,
                                  table='config',
                                  primary='guild_id',
                                  record_class=GuildConfigRecord)

        self.startup_time = datetime.utcnow()

        self.log = logging.getLogger('acebot')

        aiohttp_log = logging.getLogger('http')

        async def on_request_end(session, ctx, end):
            resp = end.response
            aiohttp_log.info('[%s %s] %s %s (%s)', str(resp.status),
                             resp.reason, end.method.upper(), end.url,
                             resp.content_type)

        trace_config = aiohttp.TraceConfig()
        trace_config.on_request_end.append(on_request_end)

        self.aiohttp = aiohttp.ClientSession(
            loop=self.loop,
            timeout=aiohttp.ClientTimeout(total=5),
            trace_configs=[trace_config],
        )

        self.modified_times = dict()
コード例 #9
0
    def __init__(self, bot):
        super().__init__(bot)

        self.config = ConfigTable(bot, 'welcome', 'guild_id', WelcomeRecord)
コード例 #10
0
    def __init__(self, bot):
        super().__init__(bot)

        self.config = ConfigTable(bot, 'trivia', ('guild_id', 'user_id'))

        self.trivia_categories = None