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

Commit

Permalink
增加清除缓存插件
Browse files Browse the repository at this point in the history
  • Loading branch information
wzpan committed Dec 24, 2017
1 parent 1f84a21 commit 21a5d87
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions client/plugins/CleanCache.py
Original file line number Diff line number Diff line change
@@ -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"清缓存"])

0 comments on commit 21a5d87

Please sign in to comment.