Skip to content

Commit

Permalink
[version] Use actual version number when asking for version
Browse files Browse the repository at this point in the history
i.e. CTCP and .version. CTCP VERSION no longer gives commit data, .version will give it if available.
  • Loading branch information
embolalia committed Jan 11, 2013
1 parent 6f7a21b commit ced9b17
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions version.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

from datetime import datetime
from subprocess import *
from willie import __version__


def git_info():
Expand All @@ -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

Expand Down Expand Up @@ -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()

0 comments on commit ced9b17

Please sign in to comment.