<commit_before>from irclib import nm_to_n
from kaarmebot import plugin_config

class Echo:
    def __init__(self, message):
        self.message = message

    @plugin_config(name="echo1", msgtypes=("pubmsg",))
    def pubmsg(self):
        msg = self.message.matchdict.get('msg')
        nick = self.message.matchdict.get('nick')
        target = self.message.metadata.get('target')
        own_nick = self.message.metadata.get('own_nick')
        if msg and nick and nick == own_nick:
            return {'privmsg': ((target,'"%s"' % msg),)}
        return None


@plugin_config(name="echo2", msgtypes=("pubmsg",))
def echo_to_source(message):
    msg = message.matchdict.get('msg')
    nick = message.matchdict.get('nick')
    target = message.metadata.get('target')
    source = nm_to_n(message.metadata.get('source'))
    own_nick = message.metadata.get('own_nick')
    if msg and nick and nick == own_nick:
        return {'privmsg': ((target, "%s: %s" % (source, msg)),)}
    return None<commit_msg>Modified the examples a bit<commit_after>from irclib import nm_to_n
from kaarmebot import plugin_config

class Echo:
    def __init__(self, message):
        self.message = message

    @plugin_config(name="echo1", msgtypes=("pubmsg",))
    def pubmsg(self):
        msg = self.message.matchdict.get('msg')
        nick = self.message.matchdict.get('nick')
        target = self.message.metadata.get('target')
        own_nick = self.message.metadata.get('own_nick')
        if msg and nick and nick == own_nick:
            return {'privmsg': ((target,'"%s"' % msg),)}
        return None


@plugin_config(name="echo2", msgtypes=("pubmsg", "privmsg"))
def echo_to_source(message):
    msg = message.matchdict.get('msg')
    nick = message.matchdict.get('nick')
    target = message.metadata.get('target')
    source = nm_to_n(message.metadata.get('source'))
    own_nick = message.metadata.get('own_nick')
    if msg and nick and nick == own_nick:
        if target != own_nick:
            return {'privmsg': ((target, "%s: %s" % (source, msg)),)}
        else:
            return {'privmsg': ((source, "%s: %s" % (source, msg)),)}
    return None
{'fraction_non_alphanumeric': 0.15498839907192574, 'fraction_numerical': 0.0018561484918793504, 'mean_word_length': 3.286282306163022, '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': '1601071', 'n_tokens_mistral': 688, 'n_tokens_neox': 675, 'n_words': 155}