Skip to content

Instantly share code, notes, and snippets.

@Ethcelon
Forked from gsathya/status.py
Last active December 20, 2015 15:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Ethcelon/6151766 to your computer and use it in GitHub Desktop.
Save Ethcelon/6151766 to your computer and use it in GitHub Desktop.
from datetime import datetime
from willie.module import commands, example
# use this to separate different parts of the status
DELIMITER = " ; "
@commands('status')
@example('.status My new status')
def status(bot, trigger):
if not trigger.group(2):
bot.reply(".status what?")
return
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)
status = status+'\n'
# write the message to file
with open("status.txt", "a") as status_fh:
status_fh.write(status)
status_fh.close()
status.priority = 'low'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment