Exemplo n.º 1
0
def cmd(send, msg, args):
    """Gets a slogan.
    Syntax: !slogan <text>
    """
    if not msg:
        msg = textutils.gen_word()
    send(textutils.gen_slogan(msg))
Exemplo n.º 2
0
def cmd(send, msg, _):
    """Gets a slogan.
    Syntax: {command} [text]
    """
    if not msg:
        msg = textutils.gen_word()
    send(textutils.gen_slogan(msg))
Exemplo n.º 3
0
def cmd(send, msg, args):
    """Gets a slogan.
    Syntax: {command} <text>
    """
    if not msg:
        msg = gen_word()
    send(gen_slogan(msg))
Exemplo n.º 4
0
def cmd(send, msg, args):
    """Gets a slogan.
    Syntax: !slogan <text>
    """
    if not msg:
        msg = gen_word()
    send(gen_slogan(msg))
Exemplo n.º 5
0
def cmd(send, msg, args):
    """Imitates pfoley.
    Syntax: !pfoley <message>
    """
    if not msg:
        msg = gen_word()
    output = gen_slogan(msg)
    send(output + " :)")
Exemplo n.º 6
0
def cmd(send, msg, args):
    """Converts text to morse code.
    Syntax: !morse <text>
    """
    if not msg:
        msg = gen_word()
    morse = gen_morse(msg)
    if len(morse) > 100:
        send("Your morse is too long. Have you considered Western Union?")
    else:
        send(morse)
Exemplo n.º 7
0
def cmd(send, msg, args):
    """Imitates fwilson.
    Syntax: {command} <message>
    """
    if not msg:
        msg = gen_word()
    match = re.match('-([wf]) .+', msg)
    if match:
        mode = match.group(1)
        msg = msg[3:]
    else:
        mode = None
    send(gen_fwilson(msg, mode))
Exemplo n.º 8
0
def cmd(send, msg, args):
    """Imitates fwilson.
    Syntax: !fwilson (-f|w) <message>
    """
    if not msg:
        msg = gen_word()
    match = re.match('-([wf]) .+', msg)
    if match:
        mode = match.group(1)
        msg = msg[3:]
    else:
        mode = None
    send(gen_fwilson(msg, mode))
Exemplo n.º 9
0
def cmd(send, msg, _):
    """Generates a shibe reaction.
    Syntax: !shibe [topic1]...[topicn]
    """
    topics = msg.split() if msg else [gen_word()]

    reaction = 'wow'
    adverbs = ['so', 'such', 'very', 'much', 'many']
    for i in topics:
        reaction += ' %s %s' % (choice(adverbs), i)

    quotes = ['omg', 'amaze', 'nice', 'clap', 'cool', 'doge', 'shibe', 'ooh']
    for i in range(randint(1, 2)):
        reaction += ' %s' % choice(quotes)
    reaction += ' wow'
    send(reaction)
Exemplo n.º 10
0
def cmd(send, msg, _):
    """Generates a shibe reaction.
    Syntax: {command} [topic1]...[topicn]
    """
    topics = msg.split() if msg else [gen_word()]

    reaction = 'wow'
    adverbs = ['so', 'such', 'very', 'much', 'many']
    for i in topics:
        reaction += ' %s %s' % (choice(adverbs), i)

    quotes = ['omg', 'amaze', 'nice', 'clap', 'cool', 'doge', 'shibe', 'ooh']
    for i in range(randint(1, 2)):
        reaction += ' %s' % choice(quotes)
    reaction += ' wow'
    send(reaction)
Exemplo n.º 11
0
def cmd(send, msg, args):
    """Gets the definition of a word.
    Syntax: {command} [--entry <num>] <word>
    """
    parser = arguments.ArgParser(args['config'])
    parser.add_argument('--entry', type=int, default=0, nargs='?')
    parser.add_argument('word', nargs='?')

    try:
        cmdargs = parser.parse_args(msg)
    except arguments.ArgumentException as e:
        send(str(e))
        return
    word = cmdargs.word if cmdargs.word is not None else textutils.gen_word()
    req = get('http://www.dictionaryapi.com/api/v1/references/collegiate/xml/%s' % word, params={'key': args['config']['api']['dictionaryapikey']})
    xml = etree.fromstring(req.content)
    defs = []
    for defn in xml.findall('./entry/def/dt'):
        if defn.text is not None:
            elems = [strip_colon(defn.text)]
        else:
            elems = []
        for elem in defn.xpath('*[not(self::ca|self::dx|self::vi|self::un|self::sx)]'):
            elems.append(strip_colon(elem.text))
        def_str = ' '.join(elems)
        if def_str:
            defs.append(def_str)

    if cmdargs.entry >= len(defs):
        if cmdargs.word:
            send("Definition not found")
        else:
            send("%s: Definition not found" % word)
    else:
        if cmdargs.word:
            send(defs[cmdargs.entry])
        else:
            send("%s: %s" % (word, defs[cmdargs.entry]))
Exemplo n.º 12
0
def cmd(send, *_):
    """Gets a random word.
    Syntax: !word
    """
    send(gen_word())
Exemplo n.º 13
0
def cmd(send, msg, args):
    """Gets a random word.
    Syntax: !word
    """
    send(gen_word())
Exemplo n.º 14
0
def cmd(send, *_):
    """Gets a random word.
    Syntax: {command}
    """
    send(gen_word())