<commit_before>from necrobot.util import server
from necrobot.botbase.commandtype import CommandType


class AddCRoWRole(CommandType):
    def __init__(self, bot_channel):
        CommandType.__init__(self, bot_channel, 'addrole')
        self.help_text = "Add yourself to a CRoW role. Use `{cmd} crow4` for the 4pm role, and `{cmd} crow11` " \
                         "for the 11pm role.".format(cmd=self.mention)

    async def _do_execute(self, cmd):
        await _modify_roles(self, cmd, add=True)


class RemoveCRoWRole(CommandType):
    def __init__(self, bot_channel):
        CommandType.__init__(self, bot_channel, 'removerole')
        self.help_text = "Remove yourself from a CRoW role. Use `{cmd} crow4` for the 4pm role, and `{cmd} crow11` " \
                         "for the 11pm role.".format(cmd=self.mention)

    async def _do_execute(self, cmd):
        await _modify_roles(self, cmd, add=False)


async def _modify_roles(cmdtype: CommandType, cmd, add: bool):
    role_map = {
        'crow4': 'CRoW Racers 4pm',
        'crow11': 'CRoW Racers 11pm'
    }

    if len(cmd.args) == 0:
        await cmdtype.client.send_message(
            cmd.channel,
            'Error: Use `{c} crow4` for the 4pm role, and `{c} crow11` " \
                     "for the 11pm role.'.format(c=cmdtype.mention)
        )
        return

    roles_to_add = []
    failed_roles = []<commit_msg>Update to single CRoW role<commit_after>from necrobot.util import server
from necrobot.botbase.commandtype import CommandType


class AddCRoWRole(CommandType):
    def __init__(self, bot_channel):
        CommandType.__init__(self, bot_channel, 'addrole')
        self.help_text = "Use `{cmd} crow` to give yourself the CRoW role.".format(cmd=self.mention)

    async def _do_execute(self, cmd):
        await _modify_roles(self, cmd, add=True)


class RemoveCRoWRole(CommandType):
    def __init__(self, bot_channel):
        CommandType.__init__(self, bot_channel, 'removerole')
        self.help_text = "Use `{cmd} crow` to remove the CRoW role from yourself.".format(cmd=self.mention)

    async def _do_execute(self, cmd):
        await _modify_roles(self, cmd, add=False)


async def _modify_roles(cmdtype: CommandType, cmd, add: bool):
    role_map = {
        'crow': 'CRoW Racers',
    }

    if len(cmd.args) == 0:
        await cmdtype.client.send_message(
            cmd.channel,
            'Error: Use `{c} crow` for the CRoW role. (No other roles currently function with this command.)'
        )
        return

    roles_to_add = []
    failed_roles = []
{'fraction_non_alphanumeric': 0.11003110419906688, 'fraction_numerical': 0.01010886469673406, 'mean_word_length': 2.823179791976226, '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': '2201708', 'n_tokens_mistral': 884, 'n_tokens_neox': 850, 'n_words': 223}