From 21a5d87ced303cd705b675a70e6daec9ea7d5b14 Mon Sep 17 00:00:00 2001 From: Joseph Pan Date: Sun, 24 Dec 2017 18:37:53 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=B8=85=E9=99=A4=E7=BC=93?= =?UTF-8?q?=E5=AD=98=E6=8F=92=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/plugins/CleanCache.py | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 client/plugins/CleanCache.py diff --git a/client/plugins/CleanCache.py b/client/plugins/CleanCache.py new file mode 100644 index 0000000..38cfa1d --- /dev/null +++ b/client/plugins/CleanCache.py @@ -0,0 +1,35 @@ +# -*- coding: utf-8-*- + +import os +import shutil + +WORDS = [u"HUANCUN"] +SLUG = "cleancache" +PRIORITY = 0 + + +def handle(text, mic, profile, wxbot=None): + """ + Reports the current time based on the user's timezone. + + Arguments: + text -- user-input, typically transcribed speech + mic -- used to interact with the user (for both input and output) + profile -- contains information related to the user (e.g., phone + number) + wxBot -- wechat robot + """ + temp = mic.dingdangpath.TEMP_PATH + shutil.rmtree(temp) + os.mkdir(temp) + mic.say(u'缓存目录已清空', cache=True) + + +def isValid(text): + """ + Returns True if input is related to the time. + + Arguments: + text -- user-input, typically transcribed speech + """ + return any(word in text.lower() for word in ["清除缓存", u"清空缓存", u"清缓存"])