<commit_before>import logging

from pajbot.modules import BaseModule, ModuleSetting
from pajbot.models.command import Command, CommandExample

from numpy import random

log = logging.getLogger(__name__)

class EightBallModule(BaseModule):

    ID = __name__.split('.')[-1]
    NAME = '8-ball'
    DESCRIPTION = 'Gives users access to the !8ball command!'
    CATEGORY = 'Game'
    SETTINGS = [
            ModuleSetting(
                key='online_global_cd',
                label='Global cooldown (seconds)',
                type='number',
                required=True,
                placeholder='',
                default=4,
                constraints={
                    'min_value': 0,
                    'max_value': 120,
                    }),
            ModuleSetting(
                key='online_user_cd',
                label='Per-user cooldown (seconds)',
                type='number',
                required=True,
                placeholder='',
                default=10,
                constraints={
                    'min_value': 0,
                    'max_value': 240,
                    }),
            ]

    def __init__(self):
        super().__init__()
        self.phrases = [
                '69% for sure',
                'are you kidding?!',
                'ask again',
                'better not tell you now',
                'definitely... not',
                'don\'t bet on it',
                'don\'t count on it',
                'doubtful',
                'for sure',
                'forget about it',
                'h    ah!',
                'hells no.',
                'if the Twitch gods grant it',
                'in due time',
                'indubitably!',
                'it is certain',
                'it is so',
                'leaning towards no',
                'look deep in your heart and you will see the answer',
                'most definitely',
                'm    ost likely',
                'my sources say yes',
                'never',
                'no wais',
                'no way!',
                'no.',
                'of course!',
                'outlook good',
                'outlook not so good',
                'perhaps',
                'please.',
                'that\'s a tough one',
                'that\'s like totally a yes. Duh!',
                '    the answer might not be not no',
                'the answer to that isn\'t pretty',
                'the heavens point to yes',
                'who knows?',
                'without a doubt',
                'yesterday it would\'ve been a yes, but today it\'s a yep',
                'you will have to     wait',
                'Signs point to yes.',
                'Yes.',
                'Reply hazy, try again.',
                'Without a doubt.',
                'My sources say no.',
                'As I see it, yes.',
                'You may rely on it.',
                'Concentrate and ask again.',
                'Outlook not so good.',
                'It is decidedly so.',
                'Better not tell you now.',
                'Very doubtful.',
                'Yes - definitely.',
                'It is certain.',
                'Cannot predict now.',
                'Most likely.',
                'Ask again later.',
                'My reply is no.',
                'Outlook good.',
                'Don\'t count on it.',
                ]

    def eightball_command(self, **options):
        source = options['source']
        bot = options['bot']
        message = options['message']

        if message and len(message) > 0:
            phrase = random.choice(self.phrases)
            bot.me('{source.username_raw}, the 8-ball says... {phrase}'.format(source=source, phrase=phrase))
        else:
            return False

    def load_commands(self, **options):
        self.commands['8ball'] = Command.raw_command(self.eightball_command,
                delay_all=self.settings['online_global_cd'],
                delay_user=self.settings['online_user_cd'],
                description='Need help with a decision? Use the !8ball command!',
                examples=[
                    CommandExample(None, '!8ball',
                        chat='user:!8ball Should I listen to gachimuchi?\n'
                        'bot:pajlada, the 8-ball says... Of course you should!',
                        description='Ask the 8ball an important question').parse(),
                    ],
                )
<commit_msg>eightball.py<commit_after>import logging

from pajbot.modules import BaseModule, ModuleSetting
from pajbot.models.command import Command, CommandExample

from numpy import random

log = logging.getLogger(__name__)

class EightBallModule(BaseModule):

    ID = __name__.split('.')[-1]
    NAME = '8-ball'
    DESCRIPTION = 'Gives users access to the !8ball command!'
    CATEGORY = 'Game'
    SETTINGS = [
            ModuleSetting(
                key='online_global_cd',
                label='Global cooldown (seconds)',
                type='number',
                required=True,
                placeholder='',
                default=4,
                constraints={
                    'min_value': 0,
                    'max_value': 120,
                    }),
            ModuleSetting(
                key='online_user_cd',
                label='Per-user cooldown (seconds)',
                type='number',
                required=True,
                placeholder='',
                default=10,
                constraints={
                    'min_value': 0,
                    'max_value': 240,
                    }),
            ]

    def __init__(self):
        super().__init__()
        self.phrases = [
            'sure',
            'are you kidding?!',
            'yeah',
            'no',
            'i think so',
            'don\'t bet on it',
            'ja',
            'doubtful',
            'for sure',
            'forget about it',
            'nein',
            'maybe',
            '<NAME>',
            'sure',
            'i dont think so',
            'it is so',
            'leaning towards no',
            'look deep in your heart and you will see the answer',
            'most definitely',
            'most likely',
            'my sources say yes',
            'never',
            'nah m8',
            'might actually be yes',
            'no.',
            'outlook good',
            'outlook not so good',
            'perhaps',
            'mayhaps',
            'that\'s a tough one',
            'idk kev',
            'don\'t ask that',
            'the answer to that isn\'t pretty',
            'the heavens point to yes',
            'who knows?',
            'without a doubt',
            'yesterday it would\'ve been a yes, but today it\'s a yep',
            'you will have to wait'
            ]
        
        self.emotes = [
            "Kappa",
            "Keepo",
            "xD",
            "KKona",
            "AlkXD",
            "4Head",
            "EleGiggle",
            "nymnWink",
            "KappaCool",
            "BrokeBack",
            "OpieOP",
            "KappaRoss",
            "KappaPride",
            "FeelsBadMan",
            "FeelsGoodMan",
            "PogChamp",
            "VisLaud",
            "OhMyDog",
            "FrankerZ",
            "DatSheffy",
            "BabyRage",
            "VoHiYo",
            "haHAA",
            "FeelsBirthdayMan",
            "LUL",
            "pajaHey",
            "pajaPepe",
            "pajaHappy",
            "pajaW",
            "pajaGASM"
            ]
                

    def eightball_command(self, **options):
        source = options['source']
        bot = options['bot']
        message = options['message']

        if message and len(message) > 0:
            phrase = random.choice(self.phrases) + " " + random.choice(self.emotes)
            bot.me('{source.username_raw}, the 8-ball says... {phrase}'.format(source=source, phrase=phrase))
        else:
            return False

    def load_commands(self, **options):
        self.commands['8ball'] = Command.raw_command(self.eightball_command,
                delay_all=self.settings['online_global_cd'],
                delay_user=self.settings['online_user_cd'],
                description='Need help with a decision? Use the !8ball command!',
                examples=[
                    CommandExample(None, '!8ball',
                        chat='user:!8ball Should I listen to gachimuchi?\n'
                        'bot:pajlada, the 8-ball says... Of course you should!',
                        description='Ask the 8ball an important question').parse(),
                    ],
                )

{'fraction_non_alphanumeric': 0.11056651088567195, 'fraction_numerical': 0.005471332497435313, 'mean_word_length': 1.1616161616161615, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 6, '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': '1433969', 'n_tokens_mistral': 2375, 'n_tokens_neox': 2189, 'n_words': 610}