def run(cls, directory: 'Service', storage: ServiceData, pd: ParamDict, *args): if not args: return cls.need_help() text = args[0] heteronym_when_single = not pd.has(cls.PSingle) resp = Tools.get(Tools.Pinyin, { 'text': text, 'heteronym_when_single': heteronym_when_single }) resp = list(filter(lambda x: x, resp)) return ' /'[len(text) == 1].join(resp)
def run(cls, directory: 'Service', storage: ServiceData, pd: ParamDict, *args): if not args: return cls.need_help() resp = Tools.get(Tools.FlowerFont, {"sentence": args[0]}) messages = [] if not resp['supported']: messages.append('暂无完全支持的花字体') else: messages.append('以下为完全支持的花字体') for font in resp['supported']: messages.append(font['sentence']) if resp['unsupported']: messages.append('下方有部分字符无法转换') for font in resp['unsupported']: messages.append(font['sentence']) return '\n'.join(messages)