Skip to content

Instantly share code, notes, and snippets.

@gsathya
Last active December 20, 2015 15:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save gsathya/6151465 to your computer and use it in GitHub Desktop.
Save gsathya/6151465 to your computer and use it in GitHub Desktop.
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