def cmd(send, msg, args): """Gets a slogan. Syntax: !slogan <text> """ if not msg: msg = textutils.gen_word() send(textutils.gen_slogan(msg))
def cmd(send, msg, _): """Gets a slogan. Syntax: {command} [text] """ if not msg: msg = textutils.gen_word() send(textutils.gen_slogan(msg))
def cmd(send, msg, args): """Gets a slogan. Syntax: {command} <text> """ if not msg: msg = gen_word() send(gen_slogan(msg))
def cmd(send, msg, args): """Gets a slogan. Syntax: !slogan <text> """ if not msg: msg = gen_word() send(gen_slogan(msg))
def cmd(send, msg, args): """Imitates pfoley. Syntax: !pfoley <message> """ if not msg: msg = gen_word() output = gen_slogan(msg) send(output + " :)")
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)
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))
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))
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)
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)
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]))
def cmd(send, *_): """Gets a random word. Syntax: !word """ send(gen_word())
def cmd(send, msg, args): """Gets a random word. Syntax: !word """ send(gen_word())
def cmd(send, *_): """Gets a random word. Syntax: {command} """ send(gen_word())