Skip to content
This repository was archived by the owner on Apr 13, 2018. It is now read-only.

Commit 21a5d87

Browse files
committed
增加清除缓存插件
1 parent 1f84a21 commit 21a5d87

1 file changed

Lines changed: 35 additions & 0 deletions

File tree

client/plugins/CleanCache.py

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# -*- coding: utf-8-*-
2+
3+
import os
4+
import shutil
5+
6+
WORDS = [u"HUANCUN"]
7+
SLUG = "cleancache"
8+
PRIORITY = 0
9+
10+
11+
def handle(text, mic, profile, wxbot=None):
12+
"""
13+
Reports the current time based on the user's timezone.
14+
15+
Arguments:
16+
text -- user-input, typically transcribed speech
17+
mic -- used to interact with the user (for both input and output)
18+
profile -- contains information related to the user (e.g., phone
19+
number)
20+
wxBot -- wechat robot
21+
"""
22+
temp = mic.dingdangpath.TEMP_PATH
23+
shutil.rmtree(temp)
24+
os.mkdir(temp)
25+
mic.say(u'缓存目录已清空', cache=True)
26+
27+
28+
def isValid(text):
29+
"""
30+
Returns True if input is related to the time.
31+
32+
Arguments:
33+
text -- user-input, typically transcribed speech
34+
"""
35+
return any(word in text.lower() for word in ["清除缓存", u"清空缓存", u"清缓存"])

0 commit comments

Comments
 (0)