示例#1
0
def cmd_ime(expr, chatid, replyid, msg):
    '''/ime [pinyin] Simple Pinyin IME.'''
    tinput = ''
    if 'reply_to_message' in msg:
        tinput = msg['reply_to_message'].get('text', '')
    tinput = (expr or tinput).strip()
    if len(tinput) > 200:
        tinput = tinput[:200] + '…'
    if not tinput:
        sendmsg('Syntax error. Usage: ' + cmd_ime.__doc__, chatid, replyid)
        return
    res = zhconv.convert(simpleime.pinyininput(tinput), 'zh-hans')
    sendmsg(res, chatid, replyid)
示例#2
0
def cmd_ime(expr):
    return zhconv.convert(simpleime.pinyininput(expr.lower()), 'zh-hans')