<commit_before>from discord import Client as DiscordClient

from utils.logging import logger

class Globibot:

    def __init__(self, web_app, module_classes, *credentials):
        self.web_app = web_app
        self.modules = list(map(lambda cls: cls(self), module_classes))
        self.credentials = credentials

        self.client = DiscordClient()
        self.client.on_ready = self.on_ready
        self.client.on_message = self.on_message

    async def boot(self):
        await self.client.start(*self.credentials)

    async def shutdown(self):
        await self.client.logout()

    async def on_ready(self):
        logger.info('Globibot is online')
        logger.info('Detected {} discord servers'.format(len(self.client.servers)))

    async def on_message(self, message):
        for module in self.modules:
            await module.dispatch(message)<commit_msg>Now dispatching messages to modules in parallel<commit_after>from discord import Client as DiscordClient

from utils.logging import logger

import asyncio

class Globibot:

    def __init__(self, web_app, module_classes, *credentials):
        self.web_app = web_app
        self.modules = list(map(lambda cls: cls(self), module_classes))
        self.credentials = credentials

        self.client = DiscordClient()
        self.client.on_ready = self.on_ready
        self.client.on_message = self.on_message

    async def boot(self):
        await self.client.start(*self.credentials)

    async def shutdown(self):
        await self.client.logout()

    async def on_ready(self):
        logger.info('Globibot is online')
        logger.info('Detected {} discord servers'.format(len(self.client.servers)))

    async def on_message(self, message):
        for module in self.modules:
            future = module.dispatch(message)
            asyncio.ensure_future(future)
{'fraction_non_alphanumeric': 0.09359870898332437, 'fraction_numerical': 0.0, 'mean_word_length': 3.03470715835141, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6771411', 'n_tokens_mistral': 539, 'n_tokens_neox': 530, 'n_words': 130}