Exemplo n.º 1
0
def until(prefix, target, event, card):
    """
    Roll in `event` until `card` is found and return a privmsg of the number of rolls
    necessary.
    """
    
    try:
        n = event.roll_until(card)
    
    except ValueError:
        line = ("Onii-chan your fat, greasy fingers must've made a typo, {0} isn't in "
                'the {1.formatted_title}!')
        line = line.format(paddb.name(card) or 'that monster', event)
        return cc.privmsg(target, line)
    
    if n:
        line = 'It took me {0} {1} of the {2.formatted_title} to roll {3}!'
        line = line.format(
            engine.number_to_words(n, threshold=100),
            engine.plural('roll', n),
            event,
            paddb.name(card) or 'that monster'
        )
    
    else:
        line = "Sorry onii-chan, looks like you don't have enough stones for that."
        
    return cc.privmsg(target, line)
Exemplo n.º 2
0
def until(prefix, target, event, card):
    """
    Roll in `event` until `card` is found and return a privmsg of the number of rolls
    necessary.
    """

    try:
        n = event.roll_until(card)

    except ValueError:
        line = (
            "Onii-chan your fat, greasy fingers must've made a typo, {0} isn't in "
            'the {1.formatted_title}!')
        line = line.format(paddb.name(card) or 'that monster', event)
        return cc.privmsg(target, line)

    if n:
        line = 'It took me {0} {1} of the {2.formatted_title} to roll {3}!'
        line = line.format(engine.number_to_words(n, threshold=100),
                           engine.plural('roll', n), event,
                           paddb.name(card) or 'that monster')

    else:
        line = "Sorry onii-chan, looks like you don't have enough stones for that."

    return cc.privmsg(target, line)
Exemplo n.º 3
0
def compare(prefix, channel, message):

    try:
        _, id1, id2, *_ = message.split(maxsplit=3)
        
    except ValueError:
        return cc.privmsg(target, 'Onii-chan you baka! Use it like this: ".compare <id 1> <id 2>"')
    
    id1, id2 = int(id1), int(id2)    
    return (cc.privmsg(channel, line) for line in statcomp(id1, id2))
Exemplo n.º 4
0
def compare(prefix, channel, message):

    try:
        _, id1, id2, *_ = message.split(maxsplit=3)

    except ValueError:
        return cc.privmsg(
            target,
            'Onii-chan you baka! Use it like this: ".compare <id 1> <id 2>"')

    id1, id2 = int(id1), int(id2)
    return (cc.privmsg(channel, line) for line in statcomp(id1, id2))
Exemplo n.º 5
0
def usage(prefix, target):
    """
    Return a generic usage message on error.
    """
    
    line = '{0.nick} no baka! Use it like this: {1} [event [event ...]]'
    line = line.format(prefix, parser.format_usage())
    
    return cc.privmsg(target, line)
Exemplo n.º 6
0
def usage(prefix, target):
    """
    Return a generic usage message on error.
    """

    line = '{0.nick} no baka! Use it like this: {1} [event [event ...]]'
    line = line.format(prefix, parser.format_usage())

    return cc.privmsg(target, line)
Exemplo n.º 7
0
def roll(prefix, target, event, hide=False, n=1):
    """Roll `n` times, yielding each result as an individual privmsg."""

    for card_id in event.roll(n):
        card = paddb.lookup(card_id)
        line = fmt.roll(prefix.nick, event.formatted_title, card, hide)
        # line = "{0.nick}-nii's {1.formatted_title} roll: {2}!"
        # line = line.format(prefix, event, paddb.name(card) or 'some monster')
        yield cc.privmsg(target, line)
Exemplo n.º 8
0
def roll(prefix, target, event, hide=False, n=1):
    """Roll `n` times, yielding each result as an individual privmsg."""
        
    for card_id in event.roll(n):
        card = paddb.lookup(card_id)
        line = fmt.roll(prefix.nick, event.formatted_title, card, hide)
        # line = "{0.nick}-nii's {1.formatted_title} roll: {2}!"
        # line = line.format(prefix, event, paddb.name(card) or 'some monster')
        yield cc.privmsg(target, line)
Exemplo n.º 9
0
def identify(*args):
    """Identify nick and user with the server, send server password, and join channels."""
    yield cc.identify(nickname='Sakubot', username='******')
    # wait for the welcome message to know we've successfully joined
    yield from sakubot.wait_for(RPL_WELCOME)
    
    password = os.environ.get('RIZON_BOT')
    yield cc.privmsg('nickserv', 'identify {0}'.format(password))
    # wait for our password to be accepted so our vhost will show up
    yield from sakubot.wait_for('NOTICE', text=cc.operator.contains('password accepted'))
    
    yield cc.join('#sakubot', '#padg')
Exemplo n.º 10
0
def chance(prefix, target, event, card, n=1):
    """
    Calculate the percent chance of rolling `card` in `n` rolls of `event` and return a
    privmsg of the results.
    """

    chance = event.chance(card, n=n)

    line = 'You have a {0} chance of rolling {1} in {2} {3} of the {4.formatted_title}.'
    line = line.format(percent(chance),
                       paddb.name(card) or 'that monster',
                       engine.number_to_words(n, threshold=100),
                       engine.plural('roll', n), event)

    return cc.privmsg(target, line)
Exemplo n.º 11
0
def chance(prefix, target, event, card, n=1):
    """
    Calculate the percent chance of rolling `card` in `n` rolls of `event` and return a
    privmsg of the results.
    """
    
    chance = event.chance(card, n=n)
    
    line = 'You have a {0} chance of rolling {1} in {2} {3} of the {4.formatted_title}.'
    line = line.format(
        percent(chance),
        paddb.name(card) or 'that monster',
        engine.number_to_words(n, threshold=100),
        engine.plural('roll', n),
        event
    )
    
    return cc.privmsg(target, line)
Exemplo n.º 12
0
def plugin(prefix, target, message):
    
    gid, token = valid_gallery(message)
    req = dict(method='gdata', gidlist=[[gid, token]], namespace=1)
    
    resp = requests.post(API, json=req)
    resp.encoding = 'UTF-8'
    
    doujin = resp.json()['gmetadata'][0]
    
    if 'error' in doujin:
        return None
    
    lines = [
        '"{0[title]}" (★ {0[rating]})'.format(doujin),
        format_tags(doujin['tags'], skip=SKIPPED)
    ]
    
    return [cc.privmsg(target, line) for line in lines]
Exemplo n.º 13
0
def plugin(prefix, target, message):

    gid, token = valid_gallery(message)
    req = dict(method='gdata', gidlist=[[gid, token]], namespace=1)

    resp = requests.post(API, json=req)
    resp.encoding = 'UTF-8'

    doujin = resp.json()['gmetadata'][0]

    if 'error' in doujin:
        return None

    lines = [
        '"{0[title]}" (★ {0[rating]})'.format(doujin),
        format_tags(doujin['tags'], skip=SKIPPED)
    ]

    return [cc.privmsg(target, line) for line in lines]
Exemplo n.º 14
0
def sakuball(prefix, channel, message):
    return cc.privmsg(channel, message='{0}: {1}'.format(prefix.nick, random.choice(sakuballList)))
Exemplo n.º 15
0
def belly(prefix, target, message):
    lewd = ['N-no..', 'S-stop..', "T-that's lewd necro-nii-sama..",
            "If that's what you like..",
            'P-please stop, t-that tickles..']
    return cc.privmsg(target, message=random.choice(lewd))
Exemplo n.º 16
0
def sakuball(prefix, channel, message):

    line = "{0.nick}: {1}".format(prefix, random.choice(options))

    return cc.privmsg(channel, line)
Exemplo n.º 17
0
def sakuball(prefix, channel, message):

    line = '{0.nick}: {1}'.format(prefix, random.choice(options))

    return cc.privmsg(channel, line)