Support for 12hour format from config file for what_time_is_it intent
This commit is contained in:
parent
37678cb247
commit
1e7f1529d2
@ -1,9 +1,18 @@
|
|||||||
|
import time
|
||||||
|
|
||||||
import utils.intents_utils
|
import utils.intents_utils
|
||||||
|
from utils import config_utils
|
||||||
|
|
||||||
|
|
||||||
def what_time_is_it():
|
def what_time_is_it():
|
||||||
|
current_time = time.localtime()
|
||||||
response = utils.intents_utils.get_response("what_time_is_it")
|
response = utils.intents_utils.get_response("what_time_is_it")
|
||||||
response.replace("{time}", "18:41")
|
|
||||||
|
if config_utils.get_in_config("12HOURS-FORMAT"):
|
||||||
|
response = response.replace('{time}', time.strftime("%I:%M %p", current_time))
|
||||||
|
else:
|
||||||
|
response = response.replace('{time}', time.strftime("%H:%M", current_time))
|
||||||
|
|
||||||
return response
|
return response
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user