-
-
Save Ethcelon/6151766 to your computer and use it in GitHub Desktop.
This file contains 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.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