diff --git a/version.py b/version.py index 23f055dd16..9ba2acfbc5 100644 --- a/version.py +++ b/version.py @@ -8,6 +8,7 @@ from datetime import datetime from subprocess import * +from willie import __version__ def git_info(): @@ -20,24 +21,25 @@ def git_info(): def version(willie, trigger): - """Display the current revision of Willie being run.""" + """Display the latest commit version, if Willie is running in a git repo.""" commit, author, date = git_info() + + if not commit.strip(): + willie.reply("Willie v. " + __version__) + return - willie.say(str(trigger.nick) + ": running version:") + willie.say(str(trigger.nick) + ": Willie v. %s at commit:" % __version__) willie.say(" " + commit) willie.say(" " + author) willie.say(" " + date) version.commands = ['version'] -version.priority = 'medium' -version.rate = 30 def ctcp_version(willie, trigger): - commit, author, date = git_info() date = date.replace(" ", "") willie.write(('NOTICE', trigger.nick), - '\x01VERSION {0} : {1}\x01'.format(commit, date)) + '\x01VERSION Willie IRC Bot version %s\x01' % __version__) ctcp_version.rule = '\x01VERSION\x01' ctcp_version.rate = 20 @@ -66,6 +68,3 @@ def ctcp_time(willie, trigger): '\x01TIME {0}\x01'.format(current_time)) ctcp_time.rule = '\x01TIME\x01' ctcp_time.rate = 20 - -if __name__ == '__main__': - print __doc__.strip()