Add time command to show datetime and timezone that the cron command will use.

This commit is contained in:
Jackson Egan 2020-05-26 13:02:32 -04:00
parent d59ea52204
commit 6c8dd0ed96
2 changed files with 4 additions and 0 deletions

View File

@ -13,6 +13,7 @@ services:
- JOIN_ON_INVITE - JOIN_ON_INVITE
- BOT_OWNERS - BOT_OWNERS
- DEBUG - DEBUG
- TZ
volumes: volumes:
- ${PWD}/config/:/bot/config - ${PWD}/config/:/bot/config
- ${PWD}/credentials.json:/bot/credentials.json - ${PWD}/credentials.json:/bot/credentials.json

View File

@ -1,4 +1,5 @@
import shlex import shlex
import os
from datetime import datetime from datetime import datetime
from .common.module import BotModule from .common.module import BotModule
@ -30,6 +31,8 @@ class MatrixModule(BotModule):
self.daily_commands.pop(room.room_id, None) self.daily_commands.pop(room.room_id, None)
bot.save_settings() bot.save_settings()
await bot.send_text(room, 'Cleared commands on this room.') await bot.send_text(room, 'Cleared commands on this room.')
elif args[0] == 'time':
await bot.send_text(room, '{datetime} {timezone}'.format(datetime=datetime.now(), timezone=os.environ.get('TZ')))
def help(self): def help(self):
return ('Runs scheduled commands') return ('Runs scheduled commands')