<commit_before>import logging

import coloredlogs

from hms_base.client import Client
from hms_base.decorators import topic

from hms_agenda.irc import AgendaBot


def get_logger():
    return logging.getLogger(__name__)


def main():
    """Entry point of the program."""

    # Logging
    coloredlogs.install(level='INFO')

    # Connect to Rabbit
    rabbit = Client('hms_agenda', 'haum', ['irc_command'])

    rabbit.connect()

    def voice_required(f):
        """Decorator that checks if the sender is voiced."""
        def wrapper(*args):
            if 'is_voiced' in args[2] and args[2]['is_voiced']:
                return f(*args)
            else:
                rabbit.publish('irc_debug', {'privmsg': 'On se connait ? Tu n’es pas voiced mon ami...'})
        return wrapper

    bot = AgendaBot(rabbit)

    @topic('irc_command')
    def callback(client, topic, message):
        
        @voice_required
        def do_work(client, topic, message):
            bot.parse_command(client, topic, message)

        if 'command' in message and message['command'] == 'agenda':
            do_work(client, topic, message)

    rabbit.listeners.append(callback)

    # Infinite listen loop
    try:
        rabbit.start_consuming()
    except KeyboardInterrupt:
        get_logger().critical('Got a keyboard interrupt')
    finally:
        rabbit.disconnect()


if __name__ == '__main__':
    main()
<commit_msg>Added !help support<commit_after>import logging

import coloredlogs

from hms_base.client import Client
from hms_base.decorators import topic

from hms_agenda.irc import AgendaBot


def get_logger():
    return logging.getLogger(__name__)


def main():
    """Entry point of the program."""

    # Logging
    coloredlogs.install(level='INFO')

    # Connect to Rabbit
    rabbit = Client('hms_agenda', 'haum', ['irc_command'])

    rabbit.connect()

    def voice_required(f):
        """Decorator that checks if the sender is voiced."""
        def wrapper(*args):
            if 'is_voiced' in args[2] and args[2]['is_voiced']:
                return f(*args)
            else:
                rabbit.publish('irc_debug', {'privmsg': 'On se connait ? Tu n’es pas voiced mon ami...'})
        return wrapper

    bot = AgendaBot(rabbit)

    @topic('irc_command')
    def callback(client, topic, message):
        
        @voice_required
        def do_work(client, topic, message):
            bot.parse_command(client, topic, message)

        if 'command' in message:
            if message['command'] == 'agenda':
                do_work(client, topic, message)
            elif message['command'] == 'help':
                bot.help()

    rabbit.listeners.append(callback)

    # Infinite listen loop
    try:
        rabbit.start_consuming()
    except KeyboardInterrupt:
        get_logger().critical('Got a keyboard interrupt')
    finally:
        rabbit.disconnect()


if __name__ == '__main__':
    main()

{'fraction_non_alphanumeric': 0.11337406653088934, 'fraction_numerical': 0.0013577732518669382, 'mean_word_length': 2.5634824667472795, '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': '2532007', 'n_tokens_mistral': 900, 'n_tokens_neox': 837, 'n_words': 234}