Last active
December 20, 2015 15:08
-
-
Save gsathya/6151465 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from datetime import datetime | |
from willie import module | |
# use this to separate different parts of the status | |
DELIMITER = ";" | |
@module.commands('status') | |
def status(bot, trigger): | |
status_msg = [] | |
# add name | |
status_msg.append(trigger.nick) | |
# add time | |
status_msg.append(datetime.now().strftime('%Y-%m-%d %H:%M:%S')) | |
# add status message | |
status_msg.append(trigger.group(2)) | |
status = DELIMITER.join(status_msg) | |
# write the message to file | |
with open("status.txt", "a") as status_fh: | |
status_fh.write(status) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment